Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Than blocking in a main loop differs from blocking in WM_NOTIFY

$
0
0
AutoIt         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) Global $iListView, $hListView $hGUI = GUICreate('', 450, 360) GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit') $iListView = GUICtrlCreateListView('Col 1', 5, 5, 440, 330, BitOR($GUI_SS_DEFAULT_LISTVIEW, $LVS_REPORT, $LVS_SHOWSELALWAYS)) $hListView = GUICtrlGetHandle(-1) For $i = 100 To 111     GUICtrlCreateListViewItem($i, $iListView) Next GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1     Sleep(100000) WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)     Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR     $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)     $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))     $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")     $iCode = DllStructGetData($tNMHDR, "Code")     Switch $hWndFrom         Case $hListView             Switch $iCode                 Case $NM_CLICK                     Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)                     MsgBox(0, 'Blocking', _GUICtrlListView_GetItemText($hListView, DllStructGetData($tInfo, "Index"), DllStructGetData($tInfo, "SubItem")), 0, $hGUI)             EndSwitch     EndSwitch     Return $GUI_RUNDEFMSG EndFunc   ;==>WM_NOTIFY Func _Exit()     Exit EndFunc   ;==>_Exit
AutoIt         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Global $hGUI, $iListView, $hListView, $iDummy $hGUI = GUICreate('', 450, 360) $iDummy = GUICtrlCreateDummy() $iListView = GUICtrlCreateListView('Col 1', 5, 5, 440, 330, BitOR($GUI_SS_DEFAULT_LISTVIEW, $LVS_REPORT, $LVS_SHOWSELALWAYS)) $hListView = GUICtrlGetHandle(-1) For $i = 100 To 111     GUICtrlCreateListViewItem($i, $iListView) Next GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1     Switch GUIGetMsg()         Case $iDummy             MsgBox(0, 'Blocking', GUICtrlRead(GUICtrlRead($iListView)), 0, $hGUI)         Case $GUI_EVENT_CLOSE             ExitLoop     EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)     Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR     $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)     $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))     $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")     $iCode = DllStructGetData($tNMHDR, "Code")     Switch $hWndFrom         Case $hListView             Switch $iCode                 Case $NM_CLICK                     GUICtrlSendToDummy($iDummy)             EndSwitch     EndSwitch     Return $GUI_RUNDEFMSG EndFunc

Why blocking of WM_NOTIFY is worse than blocking in a main loop?


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>