Hi to all, I am trying to add a function in my app to check for updates from internet. if one found it should display a message to the user asking if they want to download the update,,blah..what i have done is something like this: 1..invoke WSAstartup 2..invoke socket 3..invoke connect <<--? However , this brings a problem. at step 3 if the user is not connected to the www it windows brings the connect dialog which is not desireable! is there a way to avoid that? Thanks to all.. ( i have found 1 or 2 threads similar to my question, but they are not very clear.)
Why isn't that desirable? The user can then just choose to make a connection and update your program, that's what you want isn't it? :confused: It won't happen with people that have permanent connection will it?
Ray, What you want to do is see if there is a connection to ine internet already, you can do this by using the RAS Services, if you do something like RasEnumConnections it will tell you how many remote connections the PC currently has, so if none are returned, then you're not connected. umbongo
Hiro, If I had a program which tried to connect to the internet everytime I started it (which wasn't clearly an internet application) then this behavious would annoy me. Doing it 'quietly' like this is much better. However, I would advise Ray to have an option in his preferences, so the user can disable this action, some people find it disturbing (they think it is scanning there system and sending information back) I know it sounds paranoid, but I deleted 'Gator' that someone had installed on my system for this very reason. Each and every time I connected to the internet, it spent about 20 seconds using the connections, sending and receiving data - what the hell was it doing? it's a password program? why was it talking so much down the internet? and what with? I deleted it - mainly because I didn't actualyl use it, and because it brought my internet connection to a halt. I wouldn't have noticed otherwise.... but there you go. umbongo
Hiro, Umb :) thanks for your super-fast-reply. Hiro, us Umb said, i dont want windows every time the user starts my program to ask for www connection. it is annoying, isn't it? Umb, i wasn't planning to have an option but i will take your advice and do so.
not if your connection is being paid per minute or second. I'd freak if programs would start connecting without asking me 4 months ago. :)
hi, you can use also InternetGetConnectedState() API, from WININET.DLL(i think you will need iexplorer 3+) this API is very simple to use: the first parameter is the size of the buffer, and the second a pointer to buffer. if it return 1, you're connected to internet. i dont know the size of the buffer, but you can do something like this:
then, after calling this code, do a JZ IS_CONNECTED or a JNZ IS_NOT_CONNECTED
sub esp, 7fh mov eax, esp push 7fh push eax call InternetGetConnectionState add esp, 7fh dec eax
Hiro, my point exactly... -> if the user is connected then check if any updates are available, and if so tell the user, ELSE dont bother him! vecna, thanks..i'll check that call too...looks nice-named though:)
I think, RasEnumConnections will only enum remote connections. If you have a connection through a LAN, this will most likely not be shown. Is there a function call to get ANY existing internet connection?
InternetGetConnectedState works well. I have just tried it out (with modem and LAN connection). But its prototype is:
and you receive the state flags in the dword the first parameter points to. The flags are:
InternetGetConnectedState proto stdcall a1: ptr dword,a2:dword
which is self-explantatory.
INTERNET_CONNECTION_MODEM equ 1 INTERNET_CONNECTION_LAN equ 2 INTERNET_CONNECTION_PROXY equ 4 INTERNET_RAS_INSTALLED equ 10h INTERNET_CONNECTION_OFFLINE equ 20h INTERNET_CONNECTION_CONFIGURED equ 40h
Ray i need to implement the same thing into my program. I have no clue where to start with this really. So what steps do i need to take to get this working in my program? thanks smurf
can someone please tell me whyi always get a null handle????????????????????? i have no idea whats wrong with this. .... mov eax, SIZEOF RASCONN inc eax mov lpasconn.dwSize, eax invoke RasEnumConnections, ADDR lpasconn, ADDR lpcb, ADDR lpcConnections .if lpcConnections!=0 mov edx, lpasconn.hrasconn .if edx==NULL MSGBOX "Handle of rasconn is null" .endif .endif ..... smurf i am not sure what you are asking but the basic idea is this: 1) check if user is connected 2) if so, retreive a tiny file from my web site( the file only includes the latest version of my program) 3) check the retrieved version with the programs version 4) if newer the message user of this...etc..