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.)
Posted on 2001-07-02 04:04:00 by Ray
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?
Posted on 2001-07-02 04:09:00 by Hiroshimator
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
Posted on 2001-07-02 04:10:00 by 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
Posted on 2001-07-02 04:24:00 by 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.
Posted on 2001-07-02 04:53:00 by Ray
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. :)
Posted on 2001-07-02 05:08:00 by Hiroshimator
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:

   sub esp, 7fh
   mov eax, esp
   push 7fh
   push eax
   call InternetGetConnectionState
   add esp, 7fh
   dec eax
then, after calling this code, do a JZ IS_CONNECTED or a JNZ IS_NOT_CONNECTED
Posted on 2001-07-02 16:17:00 by vecna
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:)
Posted on 2001-07-03 09:54:00 by Ray
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?
Posted on 2001-07-03 10:07:00 by japheth
InternetGetConnectedState works well. I have just tried it out (with modem and LAN connection). But its prototype is:

InternetGetConnectedState proto stdcall a1: ptr dword,a2:dword
and you receive the state flags in the dword the first parameter points to. The flags are:

which is self-explantatory.
Posted on 2001-07-04 09:16:00 by Japheth
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
Posted on 2001-07-06 02:15:00 by 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[0].dwSize, eax invoke RasEnumConnections, ADDR lpasconn[0], ADDR lpcb, ADDR lpcConnections .if lpcConnections!=0 mov edx, lpasconn[0].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..
Posted on 2001-07-06 14:36:00 by Ray