Sign in to follow this  
Followers 0
dewclaws

Is it possible to read the binding order of adapters?

16 posts in this topic

Is it possible to read the text in order from the Windows Binding order list view?

The screen I need to read, can be opened on a Win2000, Window XP, and windows 2003 by

1) from a command prompt, type "ncpa.cpl" to open the "Network Connections" control panel.

2) press [ALT] followed by a 'n', and a 's' keystroke to open the "Advanced Settings" panel

3) now the window I need to read is the first listbox, the "Connections" binding order.


Dewclaws

Share this post


Link to post
Share on other sites



Is it possible to read the text in order from the Windows Binding order list view?

The screen I need to read, can be opened on a Win2000, Window XP, and windows 2003 by

1) from a command prompt, type "ncpa.cpl" to open the "Network Connections" control panel.

2) press [ALT] followed by a 'n', and a 's' keystroke to open the "Advanced Settings" panel

3) now the window I need to read is the first listbox, the "Connections" binding order.

Check it out with AU3Info.exe and you see it's a SysTreeView32 control. You can try the _GuiCtrlTreeView_* functions of the GuiTreeView.au3 UDF on it.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

The version of AU3Info.exe calls it a SysListView32. Is the same as a SystemTreeView32 Control?

-- Pulled from AU3Info.exe when hilighting the listbox in question.

Instance: 1

ClassnameNN: SysListView321

ID: 25000

Text: List1

Position: 21, 94

Size: 321, 72

ControlClick Coords: 222, 27

Style: 0x5001C04D

ExStyle: 0x00000204

Check it out with AU3Info.exe and you see it's a SysTreeView32 control. You can try the _GuiCtrlTreeView_* functions of the GuiTreeView.au3 UDF on it.

:)


Dewclaws

Share this post


Link to post
Share on other sites

The version of AU3Info.exe calls it a SysListView32. Is the same as a SystemTreeView32 Control?

-- Pulled from AU3Info.exe when hilighting the listbox in question.

Instance: 1

ClassnameNN: SysListView321

ID: 25000

Text: List1

Position: 21, 94

Size: 321, 72

ControlClick Coords: 222, 27

Style: 0x5001C04D

ExStyle: 0x00000204

My mistake. You are correct.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Im puzzled, how do I access this control? Any suggestions or even an example would be good.

- Dewclaws

My mistake. You are correct.

:)


Dewclaws

Share this post


Link to post
Share on other sites

Tried ControlListView()?


"be smart, drink your wine"

Share this post


Link to post
Share on other sites

Hi! If i understand your question right, then try this:

#include <GuiListView.au3>

$title = "Дополнительные параметры" ; Change this value to your title, my Windows version is russian

$hListView = ControlGetHandle($title, "", "SysListView321")

$ItemCount = _GUICtrlListView_GetItemCount($hListView)

For $i = 0 To $ItemCount - 1
    MsgBox(0, "", _GUICtrlListView_GetItemText($hListView, $i))
Next

:)

Share this post


Link to post
Share on other sites

Ahhh, thats it, I needed to use "ControlGetHandle".

Thank you!

Hi! If i understand your question right, then try this:

#include <GuiListView.au3>

$title = "Дополнительные параметры" ; Change this value to your title, my Windows version is russian

$hListView = ControlGetHandle($title, "", "SysListView321")

$ItemCount = _GUICtrlListView_GetItemCount($hListView)

For $i = 0 To $ItemCount - 1
    MsgBox(0, "", _GUICtrlListView_GetItemText($hListView, $i))
Next

:)


Dewclaws

Share this post


Link to post
Share on other sites

Is it possible to read the text in order from the Windows Binding order list view?

The screen I need to read, can be opened on a Win2000, Window XP, and windows 2003 by

1) from a command prompt, type "ncpa.cpl" to open the "Network Connections" control panel.

2) press [ALT] followed by a 'n', and a 's' keystroke to open the "Advanced Settings" panel

3) now the window I need to read is the first listbox, the "Connections" binding order.

is it that you need ?

#Include <Array.au3>
$Regkey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network"
$i=1
Dim $check1=0
Dim $Connexion_name[1]
While $check1=0
    $Subkey=RegEnumKey($Regkey,$i)
    $test=RegRead($Regkey&"\"&$Subkey,"Class")
    Select
        case $test="Net"
    ;       MsgBox(0,"",$test&@error)
        $j=1
        $check2=0
        Do
            $test2=RegEnumKey($Regkey&"\"&$Subkey&"\"&RegEnumKey($Regkey&"\"&$Subkey,$j),1)
                    If @error =1 Then $check2=1
        ;MsgBox(0,"1",$test2&"\"&$j&"\"&@error)
            If $test2="Connection" Then
                $value=RegRead($Regkey&"\"&$Subkey&"\"&RegEnumKey($Regkey&"\"&$Subkey,$j)&"\Connection","Name")
                    ;MsgBox(0,"2",$value &@error)
                Select
                    Case @error=0
                        _ArrayAdd($Connexion_name,$value)
                EndSelect
            EndIf
                $j+=1
        Until  $check2=1
    ;Case @error 
        $check1=1
    EndSelect
            $i+=1
WEnd
_ArrayDelete($Connexion_name,0)
_ArrayDisplay($Connexion_name)

Share this post


Link to post
Share on other sites

is it that you need ?

#Include <Array.au3>
$Regkey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network"
$i=1
Dim $check1=0
Dim $Connexion_name[1]
While $check1=0
    $Subkey=RegEnumKey($Regkey,$i)
    $test=RegRead($Regkey&"\"&$Subkey,"Class")
    Select
        case $test="Net"
;       MsgBox(0,"",$test&@error)
        $j=1
        $check2=0
        Do
            $test2=RegEnumKey($Regkey&"\"&$Subkey&"\"&RegEnumKey($Regkey&"\"&$Subkey,$j),1)
                    If @error =1 Then $check2=1
    ;MsgBox(0,"1",$test2&"\"&$j&"\"&@error)
            If $test2="Connection" Then
                $value=RegRead($Regkey&"\"&$Subkey&"\"&RegEnumKey($Regkey&"\"&$Subkey,$j)&"\Connection","Name")
                ;MsgBox(0,"2",$value &@error)
                Select
                    Case @error=0
                        _ArrayAdd($Connexion_name,$value)
                EndSelect
            EndIf
                $j+=1
        Until  $check2=1
;Case @error 
        $check1=1
    EndSelect
            $i+=1
WEnd
_ArrayDelete($Connexion_name,0)
_ArrayDisplay($Connexion_name)
This is awesome ! Thats exactly what i am looking for !!!!!!

Is it possible to create an "Up" and "Down" button on the gui which displays the connections to set the network adapters "Up" or "Down".

For example :

LAN

LAN2

LAN3

-> click on LAN3 -> Click "Up" Button

new listview :

LAN

LAN3

LAN2

would be so great ! :)

Share this post


Link to post
Share on other sites

This is awesome ! Thats exactly what i am looking for !!!!!!

Is it possible to create an "Up" and "Down" button on the gui which displays the connections to set the network adapters "Up" or "Down".

For example :

LAN

LAN2

LAN3

-> click on LAN3 -> Click "Up" Button

new listview :

LAN

LAN3

LAN2

would be so great ! :)

i suggest you some reading here ;)

Share this post


Link to post
Share on other sites

i suggest you some reading here :)

I know how to set adapters manually ^^ , what i want to do is :

- create a gui with a button named "Adapters"

- Clicked Button -> Open this :

$Regkey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network"
$i=1
Dim $check1=0
Dim $Connexion_name[1]
While $check1=0
    $Subkey=RegEnumKey($Regkey,$i)
    $test=RegRead($Regkey&"\"&$Subkey,"Class")
    Select
        case $test="Net"
   ;        MsgBox(0,"",$test&@error)
        $j=1
        $check2=0
        Do
            $test2=RegEnumKey($Regkey&"\"&$Subkey&"\"&RegEnumKey($Regkey&"\"&$Subkey,$j),1)
                    If @error =1 Then $check2=1
       ;MsgBox(0,"1",$test2&"\"&$j&"\"&@error)
            If $test2="Connection" Then
                $value=RegRead($Regkey&"\"&$Subkey&"\"&RegEnumKey($Regkey&"\"&$Subkey,$j)&"\Connection","Name")
                   ;MsgBox(0,"2",$value &@error)
                Select
                    Case @error=0
                        _ArrayAdd($Connexion_name,$value)
                EndSelect
            EndIf
                $j+=1
        Until  $check2=1
   ;Case @error
        $check1=1
    EndSelect
            $i+=1
WEnd
_ArrayDelete($Connexion_name,0)
_ArrayDisplay($Connexion_name)

To read out the Network Adapters.

Now i want to check if the LAN1 is at first place and if not set it at first place .

Is it possible ? - Well i actually know its possible lol ^^ i just cant figure out how ;)

Share this post


Link to post
Share on other sites

To read out the Network Adapters.

Now i want to check if the LAN1 is at first place and if not set it at first place .

Is it possible ? - Well i actually know its possible lol ^^ i just cant figure out how :)

that's what i could read on the link I gave you

Although binding and unbinding a network adapter is not difficult, moving the network adapter binding is a complex task. No API exists that you can use to move a network adapter binding. However, you can write a stand-alone application to move a network adapter binding by using the INetCfg APIs. To do this, you have to enumerate all the bindings for all the components that are installed on the adapters. Then, you have to move the binding path for each binding so that each binding appears before another binding.

For more information about the INetCfg interface, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/ms805265.aspx

You can enumerate all the adapters, and you can enumerate anything that is bound to each network adapter. Finally, you can use the INetCfgComponentBindings API to unbind the component.

Share this post


Link to post
Share on other sites

that's what i could read on the link I gave you

I wrote my own Adapter "check" now :) works fine for me but still a bit buggy. Feel free to test it!

#include <WinAPI.au3>


        Func GetActualAdapter()
            Local $hMain
            Local $hParent
            Local $hChild
            Local $hParent_
            Local $hChild_
            Local $Text

            $hChild_ = 0
            $hMain = _WinAPI_FindWindow("#32770", "Erweitert")
            $hParent = DLLCall("User32.dll", "hwnd", "FindWindowEx", "hwnd", $hMain, "hwnd", $hChild_, "str", "#32770", "str", "Netzwerkkarten und Bindungen")
            $hParent_ = $hParent[0]

        Do
            $hChild = DLLCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hParent_, "int", $hChild_, "str", "Static", "int", 0)
            $hChild_ = $hChild[0]
            $Text = _WinAPI_GetWindowText($hChild_)
        until StringInStr($Text, "&Bindungen für ") or ($hChild_ = 0)
    
        Return StringMid($Text, 16, StringLen($Text) - 16)
        EndFunc
Case $togglebutton7
            WinMinimizeAll()
            Run("rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl,,1")
            Sleep(1000)
            Send("{F10}")
            Sleep(1000)
            Send("{RIGHT 5}")
            Sleep(1000)
            Send("{DOWN 5}")
            sleep(1000)
            Send("{ENTER}")
            Sleep(1000)
            $j = 0
        while (GetActualAdapter() <> "LAN-Verbindung")
            $j = $j + 1
            send("{DOWN}")
            Sleep(1000)
        wend
        
        For $i = 1 to $j
            ControlClick("", "", 25001)
            Sleep(1000)
        Next

you will have to change : "Netzwerkkarten und Bindungen","Text, "&Bindungen für", "LAN-Verbindung" into the english expression of course ;)

Share this post


Link to post
Share on other sites

I wrote my own Adapter "check" now :) works fine for me but still a bit buggy. Feel free to test it!

#include <WinAPI.au3>


        Func GetActualAdapter()
            Local $hMain
            Local $hParent
            Local $hChild
            Local $hParent_
            Local $hChild_
            Local $Text

            $hChild_ = 0
            $hMain = _WinAPI_FindWindow("#32770", "Erweitert")
            $hParent = DLLCall("User32.dll", "hwnd", "FindWindowEx", "hwnd", $hMain, "hwnd", $hChild_, "str", "#32770", "str", "Netzwerkkarten und Bindungen")
            $hParent_ = $hParent[0]

        Do
            $hChild = DLLCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hParent_, "int", $hChild_, "str", "Static", "int", 0)
            $hChild_ = $hChild[0]
            $Text = _WinAPI_GetWindowText($hChild_)
        until StringInStr($Text, "&Bindungen für ") or ($hChild_ = 0)
    
        Return StringMid($Text, 16, StringLen($Text) - 16)
        EndFunc
Case $togglebutton7
            WinMinimizeAll()
            Run("rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl,,1")
            Sleep(1000)
            Send("{F10}")
            Sleep(1000)
            Send("{RIGHT 5}")
            Sleep(1000)
            Send("{DOWN 5}")
            sleep(1000)
            Send("{ENTER}")
            Sleep(1000)
            $j = 0
        while (GetActualAdapter() <> "LAN-Verbindung")
            $j = $j + 1
            send("{DOWN}")
            Sleep(1000)
        wend
        
        For $i = 1 to $j
            ControlClick("", "", 25001)
            Sleep(1000)
        Next

you will have to change : "Netzwerkkarten und Bindungen","Text, "&Bindungen für", "LAN-Verbindung" into the english expression of course :)

this gives me an error...have you updated this?

Share this post


Link to post
Share on other sites

this gives me an error...have you updated this?

the only way i can get it to work is with :

Run("rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl,,1")

Sleep(300)

Send("{F10}")

Send("{RIGHT 5}")

Send("{DOWN 5}")

Send("{ENTER}")

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