Sign in to follow this  
Followers 0
oliverh

List Domain over net view and write it in a listview

2 posts in this topic

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...

#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 :whistle:

greetz olli

Share this post


Link to post
Share on other sites



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...

#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 :whistle:

greetz olli

You 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

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