Zedna Posted November 1, 2011 Share Posted November 1, 2011 (edited) Here is demo example for catching/processing doubleclick NOTIFY message on StatusBar controlalso with distinguishing on which part of statusbar was clicked expandcollapse popup; http://msdn.microsoft.com/en-us/library/windows/desktop/bb760734%28v=VS.85%29.aspx #include <GUIConstantsEX.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> Global $hGUI = GUICreate("Statusbar doubleclick demo", 400, 300) $sb_dblclk_id = GUICtrlCreateDummy() ; statusbar doubleclick ID $label = GUICtrlCreateLabel('abc', 10,10,100) Global $hStatus = _GUICtrlStatusBar_Create($hGUI) Global $aParts[3] = [125, 250] _GUICtrlStatusBar_SetParts($hStatus, $aParts) _GUICtrlStatusBar_SetText($hStatus, "Text1", 0) _GUICtrlStatusBar_SetText($hStatus, "Text2", 1) _GUICtrlStatusBar_SetText($hStatus, "Text3", 2) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 Switch GuiGetMsg() Case $GUI_EVENT_CLOSE Exit Case $sb_dblclk_id OnStatusBarDoubleClick(GUICtrlRead($sb_dblclk_id)) EndSwitch WEnd Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam If $hWndGUI = $hGUI Then $NMHDR = DllStructCreate($tagNMHDR , $lParam) $hWndFrom = DllStructGetData($NMHDR, 'hWndFrom') $event = DllStructGetData($NMHDR, 'Code') If $event = $NM_DBLCLK And $hWndFrom = $hStatus Then $NMMOUSE = DllStructCreate($tagNMMOUSE , $lParam) $part = DllStructGetData($NMMOUSE, 'ItemSpec') ;~ OnStatusBarDoubleClick($part) GUICtrlSendToDummy($sb_dblclk_id, $part) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc Func OnStatusBarDoubleClick($sb_part) ConsoleWrite('statusbar doubleclick, part=' & $sb_part & ' text=' & _GUICtrlStatusBar_GetText($hStatus, $sb_part) & @CRLF) EndFunc Note that GUICtrlSendToDummy() is used only for non-blocking processing of WM_NOTIFY message, so in this way you can have in OnStatusBarDoubleClick() also long lasting or blocking code like messagebox without any harm on system. EDIT: The same way as $NM_DBLCLK can be used also $NM_CLICK Edited November 1, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
UEZ Posted November 1, 2011 Share Posted November 1, 2011 Thanks for sharing it. Can be useful someday! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Zedna Posted November 1, 2011 Author Share Posted November 1, 2011 Thanks for sharing it. Can be useful someday! I need it in my project and search on this forum gave me nothing so after solving this myself I put it here for Autoit community as it can be handy for more people :-) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
FireFox Posted November 1, 2011 Share Posted November 1, 2011 Nice example, could be usefull ! 5* Br, FireFox. Link to comment Share on other sites More sharing options...
Zedna Posted July 1, 2013 Author Share Posted July 1, 2013 Just for the reference, here is modification of my example using _SendMessage() with custom message instead of GUICtrlSendToDummy(). With GUICtrlSendToDummy() you can send only 1 parameter and it must be numeric. With _SendMessage() you can send 2 parameters (wParam+lParam) and it can be diferent types. This is ideal when catching messages in ListView where you can trap/send item/subitem or item/state parameters for example. expandcollapse popup; <a href='http://msdn.microsoft.com/en-us/library/windows/desktop/bb760734%28v=VS.85%29.aspx' class='bbc_url' title='External link' rel='nofollow external'>http://msdn.microsoft.com/en-us/library/windows/desktop/bb760734%28v=VS.85%29.aspx</a> #include <GUIConstantsEX.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> Global Const $WM_SB_DBLCLK = $WM_USER + 1 Global $hGUI = GUICreate("Statusbar doubleclick demo", 400, 300) $label = GUICtrlCreateLabel('abc', 10,10,100) Global $hStatus = _GUICtrlStatusBar_Create($hGUI) Global $aParts[3] = [125, 250] _GUICtrlStatusBar_SetParts($hStatus, $aParts) _GUICtrlStatusBar_SetText($hStatus, "Text1", 0) _GUICtrlStatusBar_SetText($hStatus, "Text2", 1) _GUICtrlStatusBar_SetText($hStatus, "Text3", 2) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") GUIRegisterMsg($WM_SB_DBLCLK, "WM_SB_DBLCLK") While 1 Switch GuiGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam If $hWndGUI = $hGUI Then $NMHDR = DllStructCreate($tagNMHDR , $lParam) $hWndFrom = DllStructGetData($NMHDR, 'hWndFrom') $event = DllStructGetData($NMHDR, 'Code') If $event = $NM_DBLCLK And $hWndFrom = $hStatus Then $NMMOUSE = DllStructCreate($tagNMMOUSE , $lParam) $part = DllStructGetData($NMMOUSE, 'ItemSpec') _SendMessage($hGUI, $WM_SB_DBLCLK, $part, 0) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc Func WM_SB_DBLCLK($hWnd, $MsgID, $wParam, $lParam) ConsoleWrite('statusbar doubleclick, part=' & $wParam & ' text=' & _GUICtrlStatusBar_GetText($hStatus, $wParam) & @CRLF) EndFunc funkey 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
guinness Posted July 1, 2013 Share Posted July 1, 2013 Nice example of using WM_USER. Thanks. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
AZJIO Posted July 1, 2013 Share Posted July 1, 2013 Note that GUICtrlSendToDummy() is used only for non-blocking processing of WM_NOTIFY message Why it is forbidden to block WM_NOTIFY? The main loop all the same blocking GUI until the operation completes. My other projects or all Link to comment Share on other sites More sharing options...
guinness Posted July 1, 2013 Share Posted July 1, 2013 Because it will cause the application to "lock up". Try it and see AZJIO. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
AZJIO Posted July 1, 2013 Share Posted July 1, 2013 guinness I tried many times and I didn't see a difference. Maybe it is necessary to open a new thread? My other projects or all Link to comment Share on other sites More sharing options...
guinness Posted July 1, 2013 Share Posted July 1, 2013 guinness I tried many times and I didn't see a difference. Maybe it is necessary to open a new thread? Yeah do that please. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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