oliverh Posted February 23, 2007 Share Posted February 23, 2007 hi @ all i would like to write my current domain in an list view. at the moment i am using the net view command to realize it. But with this command i can only list the pc names (see my code) now my question: cann you give me an example code to list the pc names AND the cooment line of the net view command!!!! here my code... expandcollapse popup#include <GUIConstants.au3> #include <GuiListView.au3> GUICreate("NetView in ListView", 220, 250, 100, 200, -1) GUISetBkColor(0x00E0FFFF) $listview = GUICtrlCreateListView("Rechnernamen", 10, 10, 200, 150, Default, $LVS_EX_GRIDLINES +$LVS_SORTDESCENDING) $button = GUICtrlCreateButton("Value?", 75, 170, 70, 20) $input1 = GUICtrlCreateInput("", 20, 200, 150) _GUICtrlListViewSetColumnWidth($listview, 0, $LVSCW_AUTOSIZE_USEHEADER) $Servernames = Net_View() For $i = 1 To UBound($Servernames) - 1 GUICtrlCreateListViewItem($Servernames[$i], $listview) Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit (0) Case $button MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2) Case $listview MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2) EndSwitch WEnd Func Net_View() Local $s_Buf = '', $a_Buf, $i_Pid = Run(@ComSpec & ' /c net view', '', @SW_HIDE, 2 + 4) While Not @error $s_Buf &= StdoutRead($i_Pid) WEnd $a_Buf = StringRegExp($s_Buf, "\\\\([0-9a-zA-Z-]*)", 3) ProcessClose($i_Pid) Return $a_Buf EndFunc and sorry for my bad english greetz olli Link to comment Share on other sites More sharing options...
PaulIA Posted February 23, 2007 Share Posted February 23, 2007 hi @ all i would like to write my current domain in an list view. at the moment i am using the net view command to realize it. But with this command i can only list the pc names (see my code) now my question: cann you give me an example code to list the pc names AND the cooment line of the net view command!!!! here my code... expandcollapse popup#include <GUIConstants.au3> #include <GuiListView.au3> GUICreate("NetView in ListView", 220, 250, 100, 200, -1) GUISetBkColor(0x00E0FFFF) $listview = GUICtrlCreateListView("Rechnernamen", 10, 10, 200, 150, Default, $LVS_EX_GRIDLINES +$LVS_SORTDESCENDING) $button = GUICtrlCreateButton("Value?", 75, 170, 70, 20) $input1 = GUICtrlCreateInput("", 20, 200, 150) _GUICtrlListViewSetColumnWidth($listview, 0, $LVSCW_AUTOSIZE_USEHEADER) $Servernames = Net_View() For $i = 1 To UBound($Servernames) - 1 GUICtrlCreateListViewItem($Servernames[$i], $listview) Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit (0) Case $button MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2) Case $listview MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2) EndSwitch WEnd Func Net_View() Local $s_Buf = '', $a_Buf, $i_Pid = Run(@ComSpec & ' /c net view', '', @SW_HIDE, 2 + 4) While Not @error $s_Buf &= StdoutRead($i_Pid) WEnd $a_Buf = StringRegExp($s_Buf, "\\\\([0-9a-zA-Z-]*)", 3) ProcessClose($i_Pid) Return $a_Buf EndFunc and sorry for my bad english greetz olliYou can use the WNet function to do this. They are implemented in Auto3Lib if you're interested. Take a look at the WNet.au3 demo and the EnumResources function in particular. Auto3Lib: A library of over 1200 functions for AutoIt 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