Sign in to follow this  
Followers 0
Zedna

StatusBar doubleclick - demo

10 posts in this topic

#1 ·  Posted (edited)

Here is demo example for catching/processing doubleclick NOTIFY message on StatusBar control

also with distinguishing on which part of statusbar was clicked

; 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 by Zedna

Share this post


Link to post
Share on other sites



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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

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 :-)

Share this post


Link to post
Share on other sites

Nice example, could be usefull !

5*

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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.

; <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
1 person likes this

Share this post


Link to post
Share on other sites

Nice example of using WM_USER. Thanks.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Because it will cause the application to "lock up". Try it and see AZJIO.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

guinness

I tried many times and I didn't see a difference. Maybe it is necessary to open a new thread?

Share this post


Link to post
Share on other sites

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.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0