PDA

Click to See Complete Forum and Search --> : Detecting if AOL is connected?


whorl
Jan 10th, 2001, 11:31 AM
Hi,

I'm writing a VB internet-enabled app and no matter what I do I can't my app to correctly identify if the computer is logged onto the Internet if the dial-up being used is AOL. I've tried numerous different methods, using API calls, the winsock control, the inet control etc. etc. OK, I can call a web page using AOL (using wininet.dll for instance) but if it's not connected it can take ages for the app to come back and say it's not connected, e.g. about 2 mins. This just isn't good - I can't expect people to wait that long.

It works fine for all other dial-ups, lans, cable modems or adsl lines but not for AOL.

Anybody got anuy ideas? This is driving me round the twist.

Cheers

Gareth

Jan 10th, 2001, 01:45 PM
To detect if AOL is open and online, search for the Welcome screen.

Private Function AOL() As Boolean
Dim aolframe As Long, mdiclient As Long, aolchild As Long
aolframe = FindWindow("aol frame25", vbNullString)
mdiclient = FindWindowEx(aolframe, 0&, "mdiclient", vbNullString)
aolchild = FindWindowEx(mdiclient, 0&, "aol child", vbNullString)
aolchild = FindWindowEx(mdiclient, aolchild, "aol child", vbNullString)

If aolchild <> 0 Then
AOL = True
Else
AOL = False
End If
End Function


Usage


Private Sub Command1_Click()

If AOL() Then
MsgBox "Connected",64,"AOL"
Else
MsgBox "Not Connected",16,"AOL"
End If

End Sub

Jan 10th, 2001, 01:49 PM
Oops...forgot to include the API functions that you need to be abled to run that code.


Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long

Private Declare Function FindWindowEx Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As _
Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

whorl
Jan 11th, 2001, 01:20 PM
Hi,

I found that on a previous post after I'd posted my message but I'm afraid to say that it doesn't appear to work with AOL 4 or 5. I will double-check the code but I'm sure it was done right and I obviously added the API declerations.

Any ideas?

Gareth

Jan 11th, 2001, 01:56 PM
AOL 4.0 it should work.

I can't help you with 5+ versions because I cannot/will not download them.

I download/installed AOL 5.0 and my computer crashed.
I stopped at 4.0..I don't use AOL a whole lot.
And VB6, I'm not taking any chances.

Get a Windows/API Spy and find the AOL Welcome window and then you can tell whether AOL is signed on or not.

Jan 18th, 2001, 07:07 PM
Here is the code I got from VB6. After I reformatted my computer, I decided to dump Netzero (piece of crap) and FreeLane Excite (piece of crap also) and just use AOL 6.0 :rolleyes:. It's crap, but it's a whole lot better than the free crap that is starting to charge.


Dim aolframe As Long, mdiclient As Long, aolchild As Long
aolframe = FindWindow("aol frame25", vbNullString)
mdiclient = FindWindowEx(aolframe, 0&, "mdiclient", vbNullString)
aolchild = FindWindowEx(mdiclient, 0&, "aol child", vbNullString)