Hi!
How can I detect the time when my modem connects/ disconnects to provider?
Thanks, Mike
How can I detect the time when my modem connects/ disconnects to provider?
Thanks, Mike
The most I can do at the moment is to point to the RAS (Remote Access Services) API functions.
;Hi, I guest this source will help you !
;##############################
IsConnected proc
LOCAL TRasCon:RASCONN
LOCAL Tstatus:RASCONNSTATUS
LOCAL lg:DWORD
LOCAL lpcon:DWORD
LOCAL lReturn:DWORD
mov dword ptr TRasCon.dwSize, 412
mov eax, dword ptr TRasCon.dwSize
shl eax, 8
mov dword ptr lg, eax
mov dword ptr lReturn, 0
INVOKE RasEnumConnections,ADDR TRasCon, ADDR lg, ADDR lpcon
cmp eax, 0
jne lab966
mov dword ptr Tstatus.dwSize, 160
INVOKE RasGetConnectStatus, TRasCon.hrasconn, ADDR Tstatus
mov dword ptr lReturn, 0;
cmp Tstatus.rasconnstate, 2000h
jne lab966
mov dword ptr lReturn,1
lab966:
mov eax, dword ptr lReturn
ret
IsConnected endp
;########################################
CheckConnected proc
szText IsConnectedTxt, "Is connected"
szText IsNotConnectedTxt, "Is not connected"
call IsConnected
cmp eax, 0
jne lab295
INVOKE MessageBox, NULL, ADDR IsNotConnectedTxt, ADDR AppName, MB_OK
ret
lab295:
INVOKE MessageBox, NULL, ADDR IsConnectedTxt, ADDR AppName, MB_OK
ret
CheckConnected endp
;##############################
IsConnected proc
LOCAL TRasCon:RASCONN
LOCAL Tstatus:RASCONNSTATUS
LOCAL lg:DWORD
LOCAL lpcon:DWORD
LOCAL lReturn:DWORD
mov dword ptr TRasCon.dwSize, 412
mov eax, dword ptr TRasCon.dwSize
shl eax, 8
mov dword ptr lg, eax
mov dword ptr lReturn, 0
INVOKE RasEnumConnections,ADDR TRasCon, ADDR lg, ADDR lpcon
cmp eax, 0
jne lab966
mov dword ptr Tstatus.dwSize, 160
INVOKE RasGetConnectStatus, TRasCon.hrasconn, ADDR Tstatus
mov dword ptr lReturn, 0;
cmp Tstatus.rasconnstate, 2000h
jne lab966
mov dword ptr lReturn,1
lab966:
mov eax, dword ptr lReturn
ret
IsConnected endp
;########################################
CheckConnected proc
szText IsConnectedTxt, "Is connected"
szText IsNotConnectedTxt, "Is not connected"
call IsConnected
cmp eax, 0
jne lab295
INVOKE MessageBox, NULL, ADDR IsNotConnectedTxt, ADDR AppName, MB_OK
ret
lab295:
INVOKE MessageBox, NULL, ADDR IsConnectedTxt, ADDR AppName, MB_OK
ret
CheckConnected endp
I think your problem is not to check if your are connected or not, but how to get the time. That is my problem too. I'm programming a program that can do it but I can't achive that. by calculating time from contected untill it is not connected but there are problems may be if you worked with me to achive that we would solve the problem.
Thanks
amr
Thanks
amr