Jump to content

Recommended Posts

Posted

Hello all,

i create GUI with

on left a treeview as ldap

on right a listview

When i select in the treeview that call func to display result in list view;

Vhen i select in the Listview that do nothing because i don't know how to do that...

My code

#include <AVIConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <TabConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>

GUICreate("ADMANAGER", 866, 706, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_GROUP, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
Global $TabSRV[4]
$TabSRV[0] = 'OU=Users,OU=SITE_SERVER1,OU=CCO,DC=ACTIVE,DC=US'
$TabSRV[1] = 'OU=Users,OU=SITE_SERVER2,OU=CCO,DC=ACTIVE,DC=US'
$TabSRV[2] = 'OU=Users,OU=SITE_SERVER3,OU=CCO,DC=ACTIVE,DC=US'
$TabSRV[3] = 'OU=Users,OU=SITE_SERVER4,OU=CCO,DC=ACTIVE,DC=US'

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlCreateTabItem("")

$treeOne = GUICtrlCreateTreeView(16, 72, 289, 609)
$treeItem = GUICtrlCreateTreeViewItem("ACTIVEDIRECTORY", $treeOne)

$SITE_SERVER1 = GUICtrlCreateTreeViewItem('USERLISTSERVER1', $treeItem)
$SITE_SERVER2 = GUICtrlCreateTreeViewItem('USERLISTSERVER2', $treeItem)
$SITE_SERVER3 = GUICtrlCreateTreeViewItem('USERLISTSERVER3', $treeItem)
$SITE_SERVER4 = GUICtrlCreateTreeViewItem('USERLISTSERVER4', $treeItem)

GUICtrlSetState($treeItem, $GUI_EXPAND)
$total = 5
Global $allusers[$total][2]

GUISetState(@SW_SHOW)

    MsgBox(64,'','PLEASE CLICK ON FIRST USERLIST IN THE LEFT LIST',1000)

While 1

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $SITE_SERVER1
            AD_listuser()
        Case $SITE_SERVER2
            MsgBox(64, '', 'USERLISTSERVER2', 1000)
        Case $SITE_SERVER3
            MsgBox(64, '', 'USERLISTSERVER3', 1000)
        Case $SITE_SERVER4
            MsgBox(64, '', 'USERLISTSERVER4', 1000)
        Case _ArraySearch($allusers, $nMsg)

;~ HERE I NEED YOUR HELP GUYS


    EndSwitch
WEnd

Func AD_listuser()
    $i = 1
    $listview = GUICtrlCreateListView("Login|Name|lastname|created|modified", 320, 56, 522, 622, '', $LVS_EX_CHECKBOXES)
    Dim $user[5]
    $user[0] = 'user0,name,lastname,01/01/2001,01/02/2003'
    $user[1] = 'user1,name,lastname,01/01/2001,01/02/2003'
    $user[2] = 'user2,name,lastname,01/01/2001,01/02/2003'
    $user[3] = 'user3,name,lastname,01/01/2001,01/02/2003'
    $user[4] = 'user4,name,lastname,01/01/2001,01/02/2003'
    For $i = 1 To 4
        $param = StringSplit($user[$i], ',')
        _ArrayInsert($allusers, $param[1])
        $allusers[$i][1] = $param[1]
;~      $allusers[$i][2] = $param[2]
;~      $allusers[$i][3] = $param[3]
;~      $allusers[$i][4] = $param[4]
;~      $allusers[$i][5] = $param[5]
;~      $allusers[$i][5] = $param[5]
        GUICtrlCreateListViewItem($param[1] & '|' & $param[2] & '|' & $param[3] & '|' & $param[4] & '|' & $param[5], $listview)
        GUICtrlSetImage(-1, "shell32.dll", 269)
    Next
    MsgBox(64,'','PLEASE HELP ME TO CODE ' & @crlf & _
                'TO DISPLAY THE NAME OF THE USER WHEN SELECTED' & @crlf & _
                'AND HOW TO RIGHT CLICK ON IT TO DO SOMES ACTIONS' & @crlf & _
                ' unlock rename move... THX A LOT FOR READING', 1000)

EndFunc   ;==>AD_listuser
Posted

Look in the help file at the example for _GuiCtrlListView_Create(). In it you see GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") and a function to handle the WM_NOTIFY messages from the control. Looking through the WM_NOTIFY() function, you see the Case to handle $NM_CLICK. If you are not familiar with message handling, it can be a steep learning curve, but is worth learning.

:mellow:

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
Posted (edited)

C:\Users\DEV\LDAP\devlistview_v.01b.au3(73,39) : ERROR: WM_NOTIFY(): undefined function.

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

:mellow:

Edited by Reekod
Posted (edited)

So... did you put a WM_NOTIFY() handler function in your script? According to that error you didn't.

:mellow:

so sorry

i called WM_NOTIFY() but the function was named _WM_NOTIFY()

i'm a stupid tired old guy :)

So great i know how to import my Active directory users and display the name of users with left click or right click...

Thank you so much Guys ! :)

now will try to display a right click menu with some option hope guicreate will do it easy

Edited by Reekod

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...