Andreik Posted October 5, 2009 Share Posted October 5, 2009 I have this script and I want to run CreateIM function just for double click on any list view item. In this moment run for one click. expandcollapse popup#include <GUIListView.au3> Global $OFFLINE_VIEW = True Global $ITEM[30] Global $MAIN = GUICreate("IM",250,500,-1,-1,0x16C80000,0x00000181) Global $LIST_VIEW = GUICtrlCreateListView("Username",5,5,240,490,BitOR(0x0004,0x0010,0x00200000)) For $INDEX = 0 To 29 $ITEM[$INDEX] = GUICtrlCreateListViewItem("User " & $INDEX,$LIST_VIEW) Next Sleep(1000) GUISetState(@SW_SHOW,$MAIN) While True $MSG = GUIGetMsg() Switch $MSG Case -3 Exit EndSwitch For $INDEX = 0 To _GUICtrlListView_GetItemCount($LIST_VIEW)-1 If $MSG = $ITEM[$INDEX] Then CreateIM(_GUICtrlListView_GetItemText($LIST_VIEW,_GUICtrlListView_GetHotItem($LIST_VIEW))) EndIf Next Sleep(10) WEnd Func CreateIM($NAME) $GUI = GUICreate($NAME,200,200) GUISetState(@SW_SHOW,$GUI) While True $GUI_MSG = GUIGetMsg() If $GUI_MSG = -3 Then GUIDelete($GUI) ExitLoop EndIf Sleep(10) WEnd EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
water Posted October 5, 2009 Share Posted October 5, 2009 I use GUIRegisterMsg to catch the user actions. The example for _GUICtrlListView_Create shows how to catch the double click event ($NM_DBLCLK). My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
wolf9228 Posted October 5, 2009 Share Posted October 5, 2009 (edited) I have this script and I want to run CreateIM function just for double click on any list view item. In this moment run for one click. expandcollapse popup#include <GUIListView.au3> Global $OFFLINE_VIEW = True Global $ITEM[30] Global $MAIN = GUICreate("IM",250,500,-1,-1,0x16C80000,0x00000181) Global $LIST_VIEW = GUICtrlCreateListView("Username",5,5,240,490,BitOR(0x0004,0x0010,0x00200000)) For $INDEX = 0 To 29 $ITEM[$INDEX] = GUICtrlCreateListViewItem("User " & $INDEX,$LIST_VIEW) Next Sleep(1000) GUISetState(@SW_SHOW,$MAIN) While True $MSG = GUIGetMsg() Switch $MSG Case -3 Exit EndSwitch For $INDEX = 0 To _GUICtrlListView_GetItemCount($LIST_VIEW)-1 If $MSG = $ITEM[$INDEX] Then CreateIM(_GUICtrlListView_GetItemText($LIST_VIEW,_GUICtrlListView_GetHotItem($LIST_VIEW))) EndIf Next Sleep(10) WEnd Func CreateIM($NAME) $GUI = GUICreate($NAME,200,200) GUISetState(@SW_SHOW,$GUI) While True $GUI_MSG = GUIGetMsg() If $GUI_MSG = -3 Then GUIDelete($GUI) ExitLoop EndIf Sleep(10) WEnd EndFunc expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Global $OFFLINE_VIEW = True Global $ITEM[30] Global $MAIN = GUICreate("IM",250,500,-1,-1,0x16C80000,0x00000181) Global $LIST_VIEW = GUICtrlCreateListView("Username",5,5,240,490,BitOR(0x0004,0x0010,0x00200000)) For $INDEX = 0 To 29 $ITEM[$INDEX] = GUICtrlCreateListViewItem("User " & $INDEX,$LIST_VIEW) Next Sleep(1000) GUISetState(@SW_SHOW,$MAIN) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While True $MSG = GUIGetMsg() Switch $MSG Case -3 Exit EndSwitch WEnd Func CreateIM($NAME) $GUI = GUICreate($NAME,200,200) GUISetState(@SW_SHOW,$GUI) While True $GUI_MSG = GUIGetMsg() If $GUI_MSG = -3 Then GUIDelete($GUI) ExitLoop EndIf Sleep(10) WEnd EndFunc Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ;~ Local $tBuffer $hWndListView = $LIST_VIEW If Not IsHWnd($LIST_VIEW) Then $hWndListView = GUICtrlGetHandle($LIST_VIEW) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView if $iCode = $NM_DBLCLK Then CreateIM(_GUICtrlListView_GetItemText($LIST_VIEW,_GUICtrlListView_GetHotItem($LIST_VIEW))) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Edited October 5, 2009 by wolf9228 صرح السماء كان هنا 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