zivt Posted July 25, 2012 Posted July 25, 2012 Hi, Is there any example code that shows how to auto connect to a WEP wireless network. if it possible no GUI!!! after searching and founding my network i want automatically connect to this network. Thanks, Ziv
somdcomputerguy Posted July 25, 2012 Posted July 25, 2012 (edited) Windows can be set to automatically connect to a network. Edited July 25, 2012 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
zivt Posted July 25, 2012 Author Posted July 25, 2012 I want to connect my 10 routers (one by one). - each router has different SSID.
kylomas Posted July 25, 2012 Posted July 25, 2012 zivt,You may find this useful...http://www.hanselman.com/blog/HowToConnectToAWirelessWIFINetworkFromTheCommandLineInWindows7.aspxkylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
MattyD Posted July 30, 2012 Posted July 30, 2012 Hey man,you may want to give a try. (It's not as complicated as it first looks!)Let me know if you run into problems,Matt
zivt Posted July 30, 2012 Author Posted July 30, 2012 Hi, Thanks for the help, after installing XP update all works fine but i dont get Connect / Disconnect NOTIFICATION any idea?
zivt Posted July 31, 2012 Author Posted July 31, 2012 Calling to _Wlan_Connect retuerns error (@error) 2. from MSDN - "The system cannot find the file specified." !APIError @Ln[2182] _WinAPI_WlanConnect - The parameter is incorrect. Any idea? Thanks, Ziv
MattyD Posted August 1, 2012 Posted August 1, 2012 hey man,Just to clarify things:An @error value of 2 only indicates the function failed because of an API error - nothing more. The actual API error code lives in @extended - this case it will be 87 (The parameter is incorrect.)As far as notifications go, XP uses them horribly. You've probably found the only codes it supports are $WLAN_NOTIFICATION_ACM_CONNECTION_COMPLETE and $WLAN_NOTIFICATION_ACM_DISCONNECTED. This is all well and good - except in XP "connection complete" does not always men the connection is complete.After calling the connect function the "connection complete" notification will appear three times. First time it will mean "the connection has started", second time associated (i assume), and finally connected. Of course if a disconnected notification appears in the middle somewhere the next connected notification will mean "the connection has started"... It is also worth noting the disconnected notification also appears a few times when disconnecting.If you don't want to deal with all that mess - just use the wait flag when calling _Wlan_Connect() and let the UDF deal with it.#include "NativeWifi.au3" $fDebugWifi = True _Wlan_StartSession() _Wlan_StartNotificationModule() Local $oProfile, $sReason $oProfile = _Wlan_CreateProfileObject() With $oProfile .Name = "Test" .SSID.Add($oProfile.Name) .Type = "Infrastructure" .Auth = "Shared Key" .Encr = "WEP" .Key.Protected = False .Key.Type = "Network Key" .Key.Material = "MyKey" EndWith If Not _Wlan_SetProfile($oProfile, $sReason) Then MsgBox(0, "Wifi", "Failed to create profile " & $oProfile.Name & ". @error=" & @error & @CRLF & "Because: " & $sReason) Exit EndIf If _Wlan_Connect($oProfile.Name, True) Then ;the True means _Wlan_Connect will wait for the connection to either complete or fail before continuing MsgBox(0, "Wifi", "Connected to " & $oProfile.Name & ".") Else MsgBox(0, "Wifi", "Connection failed to " & $oProfile.Name & ". @error=" & @error) EndIfHope this helps,Matt Doppio 1
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