Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/01/2013 in all areas

  1. JLogan3o13

    SCCM 2007 Front End

    Updated 10/03/12 - Several Functions cleaned up, Hardware Imaging Added. This is a quick GUI I wrote for a customer who wanted a custom interface to SCCM 2007 that gave them more granular control. It allows for "Tier I" and "Tier II" technician groups, each with different available actions. A Tier I technician can: Add or Remove a single machine from a collection (currently confined to Collections identified as Site Licensed).Add a group of machines to a collection from a text file (currently up to 10 machines, but this can be changed).Perform various SCCM tasks on a client (Open directories, browse log files, force a check in with the server, restart services, remote control, etc.)Reboot machines A Tier II technician can do everything above plus:Add or Remove machines from both "Site Licensed" and "Single Licensed" Collections.Perform Hardware Imaging Tasks on machinesGeneral Benefits over using the SCCM Console: Able to define different groups with different access, without having to set access rights on every Collection individually.Every action is captured in the log file (depth that SCCM lacks natively)What you need to configure: In SCCM, set the appropriate CLASS rights for the groups (ex: for collections I did Modify, Read, Read Resource, & Use Remote Tools).Modify the INI file (it defaults to looking for it in Program Files\SCCM Console\bin) to reflect your SCCM Server, your Site Code, Your log file location, and the A.D. Groups you would like to define.In the install directory (currently Program Files\SCCM Console\bin), you need to place the following files: rc.exe and rdpencom.dll (the files for SCCM Remote Tools) and Trace32.exe SCCM Console.au3 config.ini.txt
    1 point
  2. ledigeine, Does this explain better? #include <GUIConstantsEx.au3> Opt("TrayOnEventMode", 1) ; Use event trapping for tray menu Opt("TrayMenuMode", 3) ; Default tray menu items will not be shown. Global $fButton = False TrayCreateItem("Test") TrayItemSetOnEvent(-1, "_Test_Func") TrayCreateItem("") TrayCreateItem("") $hTray_Show_Item = TrayCreateItem("Hide") TrayItemSetOnEvent(-1, "To_Tray") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "On_Exit") $hGUI = GUICreate("Test", 200, 200) $cButton = GUICtrlCreateButton("Test", 10, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_MINIMIZE To_Tray() Case $cButton $fButton = True ; The button is calling the function _Test_Func() $fButton = False ; Clear the flag EndSwitch WEnd Func _Test_Func() If $fButton Then MsgBox(0, "Hi", "Testing!" & @CRLF & @CRLF & "Called from Button") Else MsgBox(0, "Hi", "Testing!" & @CRLF & @CRLF & "Called from Tray") EndIf EndFunc Func To_Tray() If TrayItemGetText($hTray_Show_Item) = "Hide" Then GUISetState(@SW_HIDE, $hGUI) TrayItemSetText($hTray_Show_Item, "Show") Else GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_RESTORE, $hGUI) TrayItemSetText($hTray_Show_Item, "Hide") EndIf EndFunc Func On_Exit() Exit EndFuncBecause we cannot use parameters with OnEvent functions (one reason why I tend only to use this mode for the tray) we need the $fButton flag to determine whether the function was fired from the tray or the button. If you do not care about which control triggered the function then you can of course delete all references to it. Any clearer? Ask again if not. M23
    1 point
  3. civilcalc, I do something similar. Several machines, not networked, send data to my WEB site via FTP. One of the machines downloads this data periodically for processing, again using FTP. This was easily put togther using the FTP functions in AutoIT (I had no previous network experience). I did this using the HELP file and forum examples. Start by putting together something to send data to your WEB site. Filezilla is an excellent tool for manual verification. This is a function that I use for sending data. Get something together and we'll go from there. Func FTPlog($lfn,$rfn) Local $server = '**************' Local $username = '*********' Local $pass = '*********' Local $Open = _FTP_Open('Samolyk FTP') If $open = 0 Then MsgBox(0,'Open Error',@error & @LF & _WinAPI_GetLastErrorMessage()) Exit endif Local $Conn = _FTP_Connect($Open, $server, $username, $pass) If $conn = 0 Then MsgBox(0,'Connect Error',@error & @LF & _WinAPI_GetLastErrorMessage()) exit endif Local $put = _FTP_FilePut($conn,$lfn,"/www/KLMS/" & $rfn) If $put = 0 Then MsgBox(0,'File Put Error',@error & @LF & _WinAPI_GetLastErrorMessage()) exit EndIf Local $Ftpc = _FTP_Close($Open) If $ftpc = 0 Then MsgBox(0,'FTP CLose Error',@error & @LF & _WinAPI_GetLastErrorMessage()) exit EndIf endfunc Good Luck, kylomas
    1 point
  4. #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <GuiImageList.au3> $hGui = GUICreate('My Program', 650, 460) $ActGroup2 = GUICtrlCreateGroup("Actions", 50, 360, 520, 50) $btnRefresh = GUICtrlCreateButton("Refresh", 70, 375, 80, 25) _GUICtrlSetImage($btnRefresh, "shell32.dll", 221) GUICtrlSetTip(-1, "Reset filter and refresh") $btnExport = GUICtrlCreateButton("Export", 170, 375, 80, 25, $BS_ICON) _GUICtrlSetImage($btnExport, "C:\Program Files\Microsoft Office\Office14\EXCEL.EXE", 1, 0) GUICtrlSetTip(-1, "Export to Excel") $btnNew = GUICtrlCreateButton("New", 270, 375, 80, 25, $BS_ICON) _GUICtrlSetImage($btnNew, "shell32.dll", 1, 0) GUICtrlSetTip(-1, "Create new RFC") $btnExit = GUICtrlCreateButton("Exit", 370, 375, 80, 25) _GUICtrlSetImage($btnExit, "shell32.dll", 329, 0) $btnOpen = GUICtrlCreateButton("Open", 470, 375, 80, 25) _GUICtrlSetImage($btnOpen, "shell32.dll", 290, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _GUICtrlSetImage($hButton, $sFileIco, $iIndIco = 0, $iSize = 0) Switch $iSize Case 0 $iSize = 16 Case 1 $iSize = 32 Case Else $iSize = 16 EndSwitch Local $hImage = _GUIImageList_Create($iSize, $iSize, 5, 3, 6) _GUIImageList_AddIcon($hImage, $sFileIco, $iIndIco) _GUICtrlButton_SetImageList($hButton, $hImage) Return $hImage EndFunc ;==>_GUICtrlSetImage
    1 point
  5. I see the problem that you describe and will have to re-think how I pass the information around. The idea was that I stored a list of volunteer ID numbers that worked that event, and that I would look up the IDs/keys to get the volunteer names and place them in the listbox on the right. Mainly because there are too many to list in a listview, so each event would show a different list on the right. I'm thinking now I'll create a new section in the ini file using the same event id followed by the ID numbers. I want to avoid using the actual names in case the name changes or simply to avoid the file getting too large. Corrected both. I still don't get any highlighting of the list item I click on. You can see in the status bar that it does pick it with click or double-click. It's as though using WM_Notify() stops the normal handling of listsviews. If I disable the function call, highlighting works but then I'll never be able to double-click to edit. ;Autoit Options ; #NoTrayIcon ;No Tray Icon Opt("GUIOnEventMode", 1) Opt("WinTextMatchMode", 1) ;1=complete, 2=quick Opt("WinTitleMatchMode", 3) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Opt("GUICloseOnESC", 0) ;1=ESC closes, 0=ESC won't close Opt("GUIResizeMode", 802) ; Opt("GUIResizeMode", 1) #Include <String.au3> #include <Date.au3> #Include <WinAPI.au3> #include <File.au3> #include <GuiTab.au3> ;#include <GDIPlus.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #include <GuiScrollBars.au3> #include <GuiStatusBar.au3> #include <GuiToolbar.au3> ; Constants includes #include <ListViewConstants.au3> #include <TabConstants.au3> #include <ToolbarConstants.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <DateTimeConstants.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ; Tab groups Global Const $L_VOLUNTEERS = " Volunteers " Global Const $L_VOLUNTEER = "Volunteer" Global Const $L_EVENTS = " Events " Global Const $L_EVENT = "Event" Global Const $L_FORMS = " Forms " Global Const $L_FORM = "Form" Global Const $L_LABELS = " Labels " Global Const $L_LABEL = "Label" Global Const $L_GLOBAL = "Global Options" ; Menus Global Const $M_FILE = "&File" Global Const $M_EDIT = "&Edit" Global Const $M_EVENT = "Even&t" Global Const $M_VOLUNTEER = "&Volunteer" Global Const $M_OPTIONS = "&Go To..." ; Buttons Global Const $L_OK = "&OK" Global Const $L_DONE = "&Done" Global Const $L_CANCEL = "&Cancel" Global Const $L_ADD = "<< &Add" Global Const $L_REMOVE = "&Remove >>" ; Prompts Global Const $L_AREYOUSURE = "Are You Sure?" Global Const $L_CANCELEXIT = "Cancel all changes and exit?" ; Tab items Global Const $T_Event = 0 Global Const $T_Volunteer = 1 Global Const $T_Forms = 2 Global Const $T_Labels = 3 ;Versions Info Global $ProgName = "Volunteer Coordinator" Global $VersionBuild = "20130213" ;YEAR|MON|DAY Global $ProgVersion = "0.1" GLOBAL $AboutVersion = "2013.02.13 (" & $ProgVersion & ")" Global $ProgWidth =1024, $ProgHeight = 720 Local $sWidth = 400, $sHeight = 350 Local $hToolbar = 40, $hStatus = 40, $hTabs = $hToolbar+30, $hLists = ($ProgHeight - $hTabs - $hStatus - $hToolbar) #Region ### START Koda GUI section ### Form=R:\AutoIt Examples\koda_2008-09-03\Forms\VolunteerCoordinator.kxf Global $MainForm = GUICreate($ProgName, $ProgWidth, $ProgHeight, (@DesktopWidth - $ProgWidth) / 2, (@DesktopHeight - $ProgHeight) / 2, $WS_SIZEBOX + $WS_SYSMENU ) GUISetState(@SW_HIDE) GUISetBkColor(0xA6CAF0) GUISetOnEvent($GUI_EVENT_CLOSE, "MainFormClose") GUISetOnEvent($GUI_EVENT_MINIMIZE, "") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "") GUISetOnEvent($GUI_EVENT_RESTORE, "") Global $TabVol = GUICtrlCreateTab(1, $hTabs-$hToolbar, $ProgWidth-2, $hToolbar, $TCS_TABS) GUICtrlSetFont(-1, 12, 400, 0, "Arial") GUICtrlSetResizing(-1, $GUI_DOCKAUTO) Global $TabSheetEvents = GUICtrlCreateTabItem($L_EVENTS) Global $ListViewEvents = GUICtrlCreateListView( _ "Date |Type |From |To ", _ 2, $hTabs, 815, $hLists-12, BitOr($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_SORTDESCENDING)) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") EventFullList() ;GUICtrlSetOnEvent(-1, "ListViewEventsClick") _GUICtrlListView_SetColumnWidth($ListViewEvents, 0, $LVSCW_AUTOSIZE_USEHEADER ) _GUICtrlListView_SetColumnWidth($ListViewEvents, 1, $LVSCW_AUTOSIZE_USEHEADER ) _GUICtrlListView_RegisterSortCallBack($ListViewEvents, True, True) Global $ListEventsVol = GUICtrlCreateList("", 819, $hTabs, 202, 618) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") ;GUICtrlSetOnEvent(-1, "ListEventsVolClick") Global $TabSheetVolunteers = GUICtrlCreateTabItem($L_VOLUNTEERS) Global $ListViewVolunteers = GUICtrlCreateListView( _ "Name |Type |Home |Work |Cell |Address |City |Prov|Postal|Notes ", _ 2, $hTabs, $ProgWidth-4, $hLists, BitOr($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_SORTASCENDING)) GUICtrlSetFont($ListViewVolunteers, 10, 400, 0, "MS Sans Serif") VolunteerFullList() ;GUICtrlSetOnEvent(-1, "ListViewVolunteersClick") _GUICtrlListView_SetColumnWidth($ListViewVolunteers, 0, $LVSCW_AUTOSIZE_USEHEADER ) _GUICtrlListView_SetColumnWidth($ListViewVolunteers, 1, $LVSCW_AUTOSIZE_USEHEADER ) _GUICtrlListView_SetColumnWidth($ListViewVolunteers, 2, $LVSCW_AUTOSIZE_USEHEADER ) _GUICtrlListView_SetColumnWidth($ListViewVolunteers, 3, $LVSCW_AUTOSIZE_USEHEADER ) _GUICtrlListView_SetColumnWidth($ListViewVolunteers, 4, $LVSCW_AUTOSIZE_USEHEADER ) _GUICtrlListView_SetColumnWidth($ListViewVolunteers, 6, $LVSCW_AUTOSIZE_USEHEADER ) _GUICtrlListView_SetColumnWidth($ListViewVolunteers, 9, $LVSCW_AUTOSIZE_USEHEADER) _GUICtrlListView_RegisterSortCallBack($ListViewVolunteers, False, True) Global $TabSheetForms = GUICtrlCreateTabItem($L_FORMS) Global $ListViewForms = GUICtrlCreateListView( _ "Name |Style ", _ 2, $hTabs, 600, $hLists, BitOr($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_SORTASCENDING)) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") ;GUICtrlSetOnEvent(-1, "ListViewFormsClick") Global $TabSheetLabels = GUICtrlCreateTabItem($L_LABELS) GUICtrlSetState(-1,$GUI_SHOW) Global $ListViewLabels = GUICtrlCreateListView( _ "Name |Style ", _ 2, $hTabs, 600, $hLists, BitOr($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_SORTASCENDING)) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") ;~ Sleep(1000) ;~ GUICtrlSetState($TabSheetVolunteers, $GUI_SHOW) ;~ Sleep(1000) ;~ GUICtrlSetState($TabSheetForms, $GUI_SHOW) ;~ Sleep(1000) ;~ GUICtrlSetState($TabSheetLabels, $GUI_SHOW) ;~ Sleep(1000) GUICtrlSetState($TabSheetEvents, $GUI_SHOW) ;GUICtrlSetOnEvent(-1, "TabVolChange") GUICtrlCreateTabItem("") ;end of tabs sleep(500) _GUICtrlTab_SetCurFocus($TabVol, $T_Event) ; _GUICtrlTab_SetCurFocus($ListViewEvents, $T_Event) ;==> FILE menu Local $MenuFile = GUICtrlCreateMenu($M_FILE) Local $MenuFileOpen = GUICtrlCreateMenuItem("Open..." & @tab & "Ctrl+O", $MenuFile) ;GUICtrlSetOnEvent(-1, "MenuFileOpenClick") Local $MenuFileSave = GUICtrlCreateMenuItem("Save" & @tab & "Ctrl+S", $MenuFile) ;GUICtrlSetOnEvent(-1, "MenuFileSaveClick") Local $MenuFileSaveAs = GUICtrlCreateMenuItem("Save As..." & @tab & "F3", $MenuFile) ;GUICtrlSetOnEvent(-1, "MenuFileSaveAsClick") Local $MenuFilePrint = GUICtrlCreateMenuItem("Print..." & @tab & "Ctrl+P", $MenuFile) ;GUICtrlSetOnEvent(-1, "MenuFilePrintClick") Local $MenuFileExit = GUICtrlCreateMenuItem("Exit" & @tab & "Ctrl+E", $MenuFile) ;GUICtrlSetOnEvent(-1, "MenuFileExitClick") ;==> EDIT menu Local $MenuEdit = GUICtrlCreateMenu($M_EDIT) ;Local $MenuEditCut = GUICtrlCreateMenuItem("Cut" & @tab & "Ctrl+X", $MenuEdit) ;GUICtrlSetOnEvent(-1, "MenuEditCutClick") ;Local $MenuEditCopy = GUICtrlCreateMenuItem("Copy" & @tab & "Ctrl+C", $MenuEdit) ;GUICtrlSetOnEvent(-1, "MenuEditCopyClick") ;Local $MenuEditPaste = GUICtrlCreateMenuItem("Paste" & @tab & "Ctrl+V", $MenuEdit) ;GUICtrlSetOnEvent(-1, "MenuEditPasteClick") Local $MenuEditListItem = GUICtrlCreateMenuItem("Edit List Item" & @tab & "F2", $MenuEdit) ;GUICtrlSetOnEvent(-1, "MenuEditListItemClick") Local $MenuGlobalOptions = GUICtrlCreateMenuItem($L_GLOBAL & @tab & "F4", $MenuEdit) ;GUICtrlSetOnEvent(-1, "MenuGlobalOptionsClick") ;==> EVENT menu Local $MenuEvent = GUICtrlCreateMenu($M_EVENT) Local $MenuEventAdd = GUICtrlCreateMenuItem("Add " & $L_EVENT & @tab & "F9", $MenuEvent) ;GUICtrlSetOnEvent(-1, "MenuEventAddClick") Local $MenuEventEdit = GUICtrlCreateMenuItem("Edit " & $L_EVENT & @tab & "F10", $MenuEvent) ;GUICtrlSetOnEvent(-1, "MenuEventEditClick") Local $MenuEventDelete = GUICtrlCreateMenuItem("Delete " & $L_EVENT & @tab & "", $MenuEvent) ;GUICtrlSetOnEvent(-1, "MenuEventDeleteClick") ;==> VOLUNTEER menu Local $MenuVolunteer = GUICtrlCreateMenu($M_VOLUNTEER) Local $MenuVolunteerAdd = GUICtrlCreateMenuItem("Add " & $L_VOLUNTEER & @tab & "F11", $MenuVolunteer) ;GUICtrlSetOnEvent(-1, "MenuVolunteerAddClick") Local $MenuVolunteerEdit = GUICtrlCreateMenuItem("Edit " & $L_VOLUNTEER & @tab & "F12", $MenuVolunteer) ;GUICtrlSetOnEvent(-1, "MenuVolunteerEditClick") Local $MenuVolunteerDelete = GUICtrlCreateMenuItem("Delete " & $L_VOLUNTEER & @tab & "", $MenuVolunteer) ;GUICtrlSetOnEvent(-1, "MenuVolunteerDeleteClick") ;==> OPTIONS menu Local $MenuOptions = GUICtrlCreateMenu($M_OPTIONS) Local $MenuEventDates = GUICtrlCreateMenuItem($L_EVENT & " Dates" & @tab & "F5", $MenuOptions) ;GUICtrlSetOnEvent(-1, "MenuEventDatesClick") Local $MenuVolList = GUICtrlCreateMenuItem($L_VOLUNTEER & " List" & @tab & "F6", $MenuOptions) ;GUICtrlSetOnEvent(-1, "MenuVolListClick") Local $MenuForms = GUICtrlCreateMenuItem("Forms" & @tab & "F7", $MenuOptions) ;GUICtrlSetOnEvent(-1, "MenuFormsClick") Local $MenuLabels = GUICtrlCreateMenuItem("Labels" & @tab & "F8", $MenuOptions) ;GUICtrlSetOnEvent(-1, "MenuLabelsClick") ;==> HELP menu Local $MenuHelp = GUICtrlCreateMenu("Help") ;GUICtrlSetOnEvent(-1, "MenuHelpClick") Local $MenuHelpAbout = GUICtrlCreateMenuItem("About" & @tab & "F1", $MenuHelp) ;GUICtrlSetOnEvent(-1, "MenuHelpAboutClick") ; MENU hotkeys ;Local $MainForm_AccelTable[3][2] = [ ["^x", $MenuEditCut],["^c", $MenuEditCopy],["^v", $MenuEditPaste] ] Local $MainForm_AccelTable[22][2] = [ _ ["^!f", $MenuFile],["^o", $MenuFileOpen],["^s", $MenuFileSave],["{F3}", $MenuFileSaveAs],["^p", $MenuFilePrint], ["^e", $MenuFileExit], _ ["^!e", $MenuEdit],["{F2}", $MenuEditListItem],["{F4}", $MenuGlobalOptions], _ ["^!t", $MenuEvent],["{F9}", $MenuEventAdd],["{F10}", $MenuEventEdit], _ ["^!v", $MenuVolunteer],["{F11}", $MenuVolunteerAdd],["{F12}", $MenuVolunteerEdit], _ ["^!g", $MenuOptions],["{F5}", $MenuEventDates],["{F6}", $MenuVolList],["{F7}", $MenuForms],["{F8}", $MenuLabels], _ ["^!h", $MenuHelp],["{F1}", $MenuHelpAbout] _ ] GUISetAccelerators($MainForm_AccelTable, $MainForm) Global $ToolBar = _GUICtrlToolbar_Create($MainForm, 0) _GUICtrlToolbar_AddButton($ToolBar, 0, 0) _GUICtrlToolbar_AddButton($ToolBar, 0, 1) _GUICtrlToolbar_AddButton($ToolBar, 0, 2) _GUICtrlToolbar_AddButton($ToolBar, 0, 3) _GUICtrlToolbar_AddButton($ToolBar, 0, 4) _GUICtrlToolbar_AddButton($ToolBar, 0, 5) Global $StatusBar = _GUICtrlStatusBar_Create($MainForm) _GUICtrlStatusBar_SetSimple($StatusBar) _GUICtrlStatusBar_SetText($StatusBar, "Simple status bar window text goes here.") _GUICtrlStatusBar_SetMinHeight($StatusBar, $hStatus) GUISetFont(10, 400, 0, "MS Sans Serif", $MainForm) GUISetOnEvent($GUI_EVENT_CLOSE, "MainFormClose") ;GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, '_PRIMARYdown') GUISetOnEvent($GUI_EVENT_RESTORE, "") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "") GUISetOnEvent($GUI_EVENT_RESIZED, "") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") #EndRegion ### END Koda GUI section ### GUISwitch($MainForm) GUISetState(@SW_SHOW) ;GUISetState(@SW_SHOW, $MainForm) While 1 sleep(100) ; If (GUIGetMsg() = $GUI_EVENT_CLOSE) Then ExitLoop WEnd GUISetState(@SW_HIDE) GUIDelete() _GUICtrlListView_UnRegisterSortCallBack($ListViewEvents) _GUICtrlListView_UnRegisterSortCallBack($ListViewVolunteers) GUIRegisterMsg($WM_NOTIFY, "") Exit Func MainFormClose() Exit EndFunc ;==>MainFormClose Func EventFullList() GUICtrlCreateListViewItem("February 12, 2013|All Day||", $ListViewEvents) GUICtrlCreateListViewItem("February 13, 2013|AM||", $ListViewEvents) GUICtrlCreateListViewItem("February 13, 2013|PM||", $ListViewEvents) GUICtrlCreateListViewItem("February 15, 2013|From|11:00|18:00", $ListViewEvents) EndFunc ;==>EventFullList Func VolunteerFullList() GUICtrlCreateListViewItem("Dan Black|Parent|(514)345-6789|(514)345-9876|(608)345-1234|239 Temple Drive|Montreal|QC|H2N3M4|Coordinator", $ListViewVolunteers) GUICtrlCreateListViewItem("Mary Pigment|Staff|(519)242-2020|(519)356-0176|(519)675-1201|21st Avenue|London|ON|J7S5M9|Principal", $ListViewVolunteers) GUICtrlCreateListViewItem("Paul Green|Friend/Family|(514)349-6699|(514)349-5555|(514)698-9857|423 Happle / Apt 12|Montreal|QC|H2N5L1|", $ListViewVolunteers) GUICtrlCreateListViewItem("Sheila Blue|Other|(514)345-7733|(514)655-4562|(608)345-1234|239 Temple Drive|Montreal|QC|H2N3M4|Coordinator", $ListViewVolunteers) EndFunc ;==>VolunteerFullList Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView1 = GUICtrlGetHandle($ListViewEvents) $hWndListView2 = GUICtrlGetHandle($ListViewVolunteers) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView1 Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) ; Kick off the sort callback _GUICtrlListView_SortItems($hWndFrom, DllStructGetData($tInfo, "SubItem")) ; No return value Case $LVN_ITEMCHANGING ; An item is changing $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) Return True ; prevent the change ;Return False ; allow the change Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $text = _GUICtrlListView_GetItemText($ListViewEvents, DllStructGetData($tInfo, "Index")) _GUICtrlStatusBar_SetText($StatusBar, "You clicked on: " & $text) ; _GUICtrlListView_SetItemSelected($ListViewEvents, DllStructGetData($tInfo, "Index")) Return $GUI_RUNDEFMSG ; No return value Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $text = _GUICtrlListView_GetItemText($ListViewEvents, DllStructGetData($tInfo, "Index")) _GUICtrlStatusBar_SetText($StatusBar, "You double-clicked on: " & $text) Return $GUI_RUNDEFMSG ; DO EDIT HERE ; No return value Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key $text = _GUICtrlListView_GetItemText($ListViewEvents, DllStructGetData($tInfo, "Index")) _GUICtrlStatusBar_SetText($StatusBar, "You hit ENTER on: " & $text) EndSwitch Case $hWndListView2 Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) ; Kick off the sort callback _GUICtrlListView_SortItems($hWndFrom, DllStructGetData($tInfo, "SubItem")) ; No return value Case $LVN_ITEMCHANGING ; An item is changing $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) Return True ; prevent the change ;Return False ; allow the change Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $text = _GUICtrlListView_GetItemText($ListViewVolunteers, DllStructGetData($tInfo, "Index")) _GUICtrlStatusBar_SetText($StatusBar, "You clicked on: " & $text) ; _GUICtrlListView_SetItemSelected($ListViewVolunteers, DllStructGetData($tInfo, "Index")) ;Return $GUI_RUNDEFMSG ; No return value Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $text = _GUICtrlListView_GetItemText($ListViewVolunteers, DllStructGetData($tInfo, "Index")) _GUICtrlStatusBar_SetText($StatusBar, "You double-clicked on: " & $text) ;Return $GUI_RUNDEFMSG ; No return value ; DO EDIT HERE Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key $text = _GUICtrlListView_GetItemText($ListViewVolunteers, DllStructGetData($tInfo, "Index")) _GUICtrlStatusBar_SetText($StatusBar, "You hit ENTER on: " & $text) ; No return value ; DO EDIT HERE EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
    1 point
×
×
  • Create New...