Sign in to follow this  
Followers 0
Ramso

Dll use to execute the Windows WLAN properties window

2 posts in this topic

Hi!, first, i dont have much experience with AutoIT but im doing my best to learn it.

For a project at work i need to directly open the WLAN and LAN properties windows for WIN7 and 8 (see image). I suppose it is possible doing a Dllcall. I really tried to look for it but Im really lost with Dlls. I dont know which one should I be looking in and which function should I use. I would appreciate it if anyone knows!

MINBn0k.jpg

 

Share this post


Link to post
Share on other sites



Hello Ramso!

This script is not perfect, because it's mixing adapters with adapter names, but it works.

 

#include <Array.au3>

Global $aNetwork = _GetNetworkAdapterInfos()
_ArrayDisplay($aNetwork)
_OpenNetworkConnectionProperties($aNetwork, "Drahtlosnetzwerkverbindung 2")


Func _OpenNetworkConnectionProperties($aNetwork, $sNetworkName)
    For $i = 0 To UBound($aNetwork, 1) - 1
        If $sNetworkName = $aNetwork[$i][0] Then
            Run("explorer ::{208D2C60-3AEA-1069-A2D7-08002B30309D}\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}\::" & $aNetwork[$i][1])
            ExitLoop

        EndIf

    Next
EndFunc   ;==>_OpenNetworkConnectionProperties





Func _GetNetworkAdapterInfos()
    Local $i = 0
    Local $aNetwork[1][2]

    Local $StartKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards"
    Local $sTempKey



    While 1
        $i += 1
        $sTempKey = RegEnumKey($StartKey, $i)
        If @error <> 0 Then ExitLoop

        ReDim $aNetwork[$i][2]
        $aNetwork[$i - 1][0] = RegRead($StartKey & "\" & $sTempKey, "Description")
        $aNetwork[$i - 1][1] = RegRead($StartKey & "\" & $sTempKey, "ServiceName")
    WEnd





    Local $j = 0, $k = 0, $m = 0
    Local $aNetworkEx[1][2]

    Local $StartKeyEx = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network"
    Local $sTempKeyEx, $sTempKeyEx2

    While 1
        $j += 1
        $sTempKeyEx = RegEnumKey($StartKeyEx, $j)
        If @error <> 0 Then ExitLoop

        If StringLeft($sTempKeyEx, 1) <> "{" Then ContinueLoop



        $k = 0
        While 1
            $k += 1
            $sTempKeyEx2 = RegEnumKey($StartKeyEx & "\" & $sTempKeyEx, $k)
            If @error <> 0 Then ExitLoop



            If RegRead($StartKeyEx & "\" & $sTempKeyEx & "\" & $sTempKeyEx2 & "\Connection", "MediaSubType") == "" Then ContinueLoop



            $m += 1
            ReDim $aNetworkEx[$m][2]
            $aNetworkEx[$m - 1][0] = RegRead($StartKeyEx & "\" & $sTempKeyEx & "\" & $sTempKeyEx2 & "\Connection", "Name")
            $aNetworkEx[$m - 1][1] = $sTempKeyEx2
        WEnd

    WEnd



    Local $iUbound = UBound($aNetwork, 1)
    Local $iUboundEx = UBound($aNetworkEx, 1)

    ReDim $aNetwork[$iUbound + $iUboundEx][2]


    For $i = $iUbound To UBound($aNetwork, 1) - 1
        $aNetwork[$i][0] = $aNetworkEx[$i - $iUbound][0]
        $aNetwork[$i][1] = $aNetworkEx[$i - $iUbound][1]
    Next

    Return $aNetwork

EndFunc   ;==>_GetNetworkAdapterInfos

 


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0