Prime Posted April 21, 2006 Share Posted April 21, 2006 Hi,I have a problem using the command "DLLCALL"!I try to better explain:I want to make a little programm that can check if I am online or not using a function inside the WININET.dll; this function is "InternetGetconnectedState".To get some more info I go to the microsoftwebsite and the result of my search was this:link to the page: MSDN for InternetgetconnectedstateWindows Internet InternetGetConnectedState Retrieves the connected state of the local system. BOOL InternetGetConnectedState( LPDWORD lpdwFlags, DWORD dwReserved ); Parameters lpdwFlags [out] Pointer to a variable that receives the connection description. This parameter may return a valid flag even when the function returns FALSE. This parameter can be one or more of the following values. Value Meaning INTERNET_CONNECTION_CONFIGURED 0x40 Local system has a valid connection to the Internet, but it might or might not be currently connected. INTERNET_CONNECTION_LAN 0x02 Local system uses a local area network to connect to the Internet. INTERNET_CONNECTION_MODEM 0x01 Local system uses a modem to connect to the Internet. INTERNET_CONNECTION_MODEM_BUSY 0x08 No longer used. INTERNET_CONNECTION_OFFLINE 0x20 Local system is in offline mode. INTERNET_CONNECTION_PROXY 0x04 Local system uses a proxy server to connect to the Internet. dwReserved [in] Reserved. Must be zero. Return ValuesAfter this I try to create the programm but the result of my function is always equal to zero ( if I am connected or not to internet... always zero... )This is my code#include <GUIConstants.au3> #NoTrayIcon GUICreate("Connected", 240, 70) GUICtrlCreateGroup("Check if U are connected", 15, 15, 210, 50) $info = GUICtrlCreateButton("Check", 30, 35, 180, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $info _consta() EndSelect WEnd GUIDelete() Func _consta($n ='',$last = 0) global $contoint = DllCall('wininet.dll', 'long', 'InternetGetconnectedState', 'ptr', $n, 'long', $last) MsgBox ( 0, "RESULT", $contoint ) MsgBox ( 0, "There are ERRs?", @error ) EndFunc ExitPlease someone help me to find the error Link to comment Share on other sites More sharing options...
GaryFrost Posted April 21, 2006 Share Posted April 21, 2006 expandcollapse popup#include <GUIConstants.au3> #NoTrayIcon GUICreate("Connected", 240, 70) GUICtrlCreateGroup("Check if U are connected", 15, 15, 210, 50) $info = GUICtrlCreateButton("Check", 30, 35, 180, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $info _consta() EndSelect WEnd Exit Func _consta($n = '', $last = 0) Local $INTERNET_CONNECTION_CONFIGURED = 0x40;Local system has a valid connection to the Internet, but it might or might not be currently connected. Local $INTERNET_CONNECTION_LAN = 0x02;Local system uses a local area network to connect to the Internet. Local $INTERNET_CONNECTION_MODEM = 0x01;Local system uses a modem to connect to the Internet. Local $INTERNET_CONNECTION_MODEM_BUSY = 0x08;No longer used. Local $INTERNET_CONNECTION_OFFLINE = 0x20;Local system is in offline mode. Local $INTERNET_CONNECTION_PROXY = 0x04;Local system uses a proxy server to connect to the Internet. Local $s_connect, $struct $struct = DllStructCreate("int") Local $contoint = DllCall('Wininet.dll', 'int', 'InternetGetConnectedState', 'ptr', DllStructGetPtr($struct), 'int', 0) If @error Then MsgBox(0, "There are ERRs?", @error) ElseIf IsArray($contoint) Then If BitAND(DllStructGetData($struct, 1), $INTERNET_CONNECTION_CONFIGURED) = $INTERNET_CONNECTION_CONFIGURED Then $s_connect = "INTERNET CONNECTION CONFIGURED" & @LF EndIf If BitAND(DllStructGetData($struct, 1), $INTERNET_CONNECTION_LAN) = $INTERNET_CONNECTION_LAN Then $s_connect = $s_connect & "Connected to LAN" & @LF EndIf If BitAND(DllStructGetData($struct, 1), $INTERNET_CONNECTION_MODEM) = $INTERNET_CONNECTION_MODEM Then $s_connect = $s_connect & "Connected to Modem" & @LF EndIf If BitAND(DllStructGetData($struct, 1), $INTERNET_CONNECTION_OFFLINE) = $INTERNET_CONNECTION_OFFLINE Then $s_connect = $s_connect & "Offline" & @LF EndIf If BitAND(DllStructGetData($struct, 1), $INTERNET_CONNECTION_PROXY) = $INTERNET_CONNECTION_PROXY Then $s_connect = $s_connect & "System uses a proxy server" & @LF EndIf EndIf MsgBox(0, "RESULT", $s_connect) $struct = 0 EndFunc ;==>_consta SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Prime Posted April 21, 2006 Author Share Posted April 21, 2006 Tnx Gafrost for your rapid help... but the result said always.. that I am OFFLINE... but I am online... Boh! Tnx again for your help Link to comment Share on other sites More sharing options...
Valuater Posted April 21, 2006 Share Posted April 21, 2006 Gary... i was connected with Firefox, and recieved a blank message box from the script. then i connected with IE and the script gave me a "lan" connection so it was blank until i ran IE ??? 8) Link to comment Share on other sites More sharing options...
GaryFrost Posted April 21, 2006 Share Posted April 21, 2006 Gary... i was connected with Firefox, and recieved a blank message box from the script.then i connected with IE and the script gave me a "lan" connectionso it was blank until i ran IE???8)Requires Internet Explorer 4.0 or later. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Prime Posted April 21, 2006 Author Share Posted April 21, 2006 Requires Internet Explorer 4.0 or later.Yeah! with IE works correctly ^^tnx man Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now