PDA

Click to See Complete Forum and Search --> : get notice when the user connect to internet


shila
Feb 5th, 2001, 09:53 AM
hello
How can I get an event(or a notice) the minute a user logs on the internet(as in icq, when the red icon turns to green icon).
I tried using GetInternetConnectedState but it's not the same, and it also has problem, when a user has a Lan connection.
thnx alot

KrishnaSantosh
Feb 7th, 2001, 05:09 AM
Hi ,


My EMail Is : santoshkrishna@santoshsmail.com

Please Enter the following code.

private declare function RegOpenKey lib "advapi32.dll"
alias "RegOpenKeyA" (byval hKey as long,byval lpSubkey as string,phkResult as long) as long

private declare function RegCloseKey lib "advapi32.dll" (byval hKey as long) as long

private declare function RegQueryValueEx lib "advapi32.dll" alias "RegQueryValueExA" (byval hKey as long,byval lpValueName as string,byval lpReserved as as long, lpType as long,lpData as any,lpcbData as long) as long

public function IsNetConnected() as boolean

dim phkResult as long,lpData as long,lpcbData as long
dim nReturnCode as long

IsNetConnected=false

ReturnCode=RegOpenKey(&H80000002, _
"System\CurrentControlSet\Services\RemoteAccess", _
phkResult)

if ReturnCode=0& then

lpData=0&
lpcbData=0&
ReturnCode=RegQueryValueEx(phkResult, _
"Remote Connection",0&,0&,byval lpData,lpcbData)

lpcbData=len(lpData)

ReturnCode=RegQueryValueEx(phkResult, _
"Remote Connection",0&,0&,lpData,lpcbData)

if ReturnCode=0& and lpData<>0 Then
IsNetConnected=true
endif

RegCloseKey(phkResult)

End Function

shila
Feb 7th, 2001, 05:29 AM
hello Santosh...
thnx for your reply but...
I don't want a function that returns a TRUE/FALSE of whether the user is logged on - insted I want to trap the event that is raised he moment A user is logging-in.
Have you ever encountered that function?
thnx again

KrishnaSantosh
Feb 7th, 2001, 11:43 PM
I Think you can do a simple program that sits in the SysTray and monitors the Connection. As Soon As The Connection Is Made(TRUE is returned) just Raise n Event. Hope you know Custom Event Declaration and Event Firing.