ravaged1 Posted November 15, 2013 Posted November 15, 2013 The code below pulled the info needed, but I want to build a drop down list so the user can select the "Description" Then I'll bind to the corresponding "ServiceName" of that Nic. So I need to get this info into Variables somehow. $key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\" For $i = 1 To 50 $var = RegEnumKey($key, $i) If @error <> 0 Then ExitLoop Local $var2 = RegRead($key & $var, "ServiceName") Local $var3 = RegRead($key & $var, "Description") MsgBox(4096, "ServiceName:", $var & $var2 & $var3) Next Anyone know the best way to accomplish this goal? Do I need to use an array?
kylomas Posted November 15, 2013 Posted November 15, 2013 raveged1, This may help get you started... expandcollapse popup#include <array.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> local $key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\" local $aResult[50][2] ; max of 50 as indicated by your loop For $i = 1 To 50 $var = RegEnumKey($key, $i) If @error <> 0 Then ExitLoop $aResult[$i-1][0] = RegRead($key & $var, "ServiceName") $aResult[$i-1][1] = RegRead($key & $var, "Description") Next redim $aResult[$i][2] ; reduce array to used number of rows _arraydisplay($aResult) local $gui010 = guicreate('Simple Drop Down Box From Array') local $cards = guictrlcreatecombo('Select a Network Card...',20,20,300,20) local $pop_str for $1 = 0 to ubound($aResult) - 1 if $aResult[$1][1] <> '' then $pop_str &= $aResult[$1][1] & '|' Next GUICtrlSetData($cards,$pop_str) guisetstate() while 1 switch guigetmsg() case $GUI_EVENT_CLOSE Exit case $cards ConsoleWrite('Item selected = ' & guictrlread($cards) & @LF) EndSwitch wend kylomas 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
ravaged1 Posted November 15, 2013 Author Posted November 15, 2013 Thanks Kylomas, I really needed a push.
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