mLipok

_GUICtrlStatusBar_EmbedControl - problem with button

7 posts in this topic

What I'am doing wrong - I cant Embed Button to statusbar

#include <GUIConstantsEx.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

Example()

Func Example()
    Local $hGUI, $hProgress, $hButton, $input, $progress, $hStatus
    Local $aParts[4] = [80, 160, 300, -1]

    ; Create GUI
    $hGUI = GUICreate("StatusBar Embed Control", 400, 300)

    ;===============================================================================
    ; defaults to 1 part, no text
    $hStatus = _GUICtrlStatusBar_Create($hGUI)
    _GUICtrlStatusBar_SetMinHeight($hStatus, 20)

    ;===============================================================================
    GUISetState(@SW_SHOW)

    ; Initialize parts
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_SetText($hStatus, "Part 1")
    _GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)

    ; Embed a progress bar
    If @OSType = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE) ; marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200) ; marquee works on Win XP and above
    EndIf

    Local $aRect_stop = _GUICtrlStatusBar_GetRect($hStatus, 3)
    $idButton = GUICtrlCreateButton("Help", $aRect_stop[0] + 2, $aRect_stop[1] + 2, ($aRect_stop[2] - $aRect_stop[0]) - 4, 16, $BS_CENTER)
    $hButton = GUICtrlGetHandle($input)
    _GUICtrlStatusBar_EmbedControl($hStatus, 3, $hButton, 4)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd
    GUIDelete()
EndFunc   ;==>Example

mLipok


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites



.... :)

I was blind or just tired (I had a rough night I slept only 3 hours).

Thanks LarsJ

 

The second question is how to catch the event - button clicked:

#include <GUIConstantsEx.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

Example()

Func Example()
    Local $hGUI, $hProgress, $hButton, $input, $progress, $hStatus
    Local $aParts[4] = [80, 160, 300, -1]

    ; Create GUI
    $hGUI = GUICreate("StatusBar Embed Control", 400, 300)

    ;===============================================================================
    ; defaults to 1 part, no text
    $hStatus = _GUICtrlStatusBar_Create($hGUI)
    _GUICtrlStatusBar_SetMinHeight($hStatus, 20)

    ;===============================================================================
    GUISetState(@SW_SHOW)

    ; Initialize parts
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_SetText($hStatus, "Part 1")
    _GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)

    ; Embed a progress bar
    If @OSType = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE) ; marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200) ; marquee works on Win XP and above
    EndIf

    Local $aRect_stop = _GUICtrlStatusBar_GetRect($hStatus, 3)
    $idButton = GUICtrlCreateButton("Help", $aRect_stop[0] + 2, $aRect_stop[1] + 2, ($aRect_stop[2] - $aRect_stop[0]) - 4, 16, $BS_CENTER)
    $hButton = GUICtrlGetHandle($idButton)
    _GUICtrlStatusBar_EmbedControl($hStatus, 3, $hButton, 4)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idButton
                MsgBox(0, '', 'TEST')
        EndSwitch
    WEnd
    GUIDelete()
EndFunc   ;==>Example

mLipok


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

Can't you use the usual trick: Add an extra GUI, add the button to the GUI, embed the GUI in the status bar, get the button click from the GUI in the usual way for scripts with multiple GUIs?

And then of course, you also have to deal with the usual problems associated with using multiple GUIs. And it may become more difficult when one GUI is embedded in a status bar.

Share this post


Link to post
Share on other sites

Thanks I'll try.


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I looked in to 

Func _GUICtrlStatusBar_Create($hWnd, $vPartEdge = -1, $vPartText = "", $iStyles = -1, $iExStyles = -1)
.....
Local $hWndSBar = _WinAPI_CreateWindowEx($iExStyles, $__STATUSBARCONSTANT_ClassName, "", $iStyle, 0, 0, 0, 0, $hWnd, $nCtrlID)
.....
EndFunc

So I do not need create new Gui/Window as _GUICtrlStatusBar_Create do it.

When I realize that,  then I try somethink like this:

#include <GUIConstantsEx.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>
#include <array.au3>

Example()

Func Example()
    Local $hGUI, $hProgress, $hButton, $input, $progress, $hStatus
    Local $aParts[4] = [80, 160, 300, -1]

    ; Create GUI
    $hGUI = GUICreate("StatusBar Embed Control", 400, 300)

    ;===============================================================================
    ; defaults to 1 part, no text
    $hStatus = _GUICtrlStatusBar_Create($hGUI)
    _GUICtrlStatusBar_SetMinHeight($hStatus, 20)

    ;===============================================================================
    GUISetState(@SW_SHOW)

    ; Initialize parts
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_SetText($hStatus, "Part 1")
    _GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)

    ; Embed a progress bar
    If @OSType = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE) ; marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200) ; marquee works on Win XP and above
    EndIf

    Local $aRect_stop = _GUICtrlStatusBar_GetRect($hStatus, 3)
    $idButton = GUICtrlCreateButton("Help", $aRect_stop[0] + 2, $aRect_stop[1] + 2, ($aRect_stop[2] - $aRect_stop[0]) - 4, 16, $BS_CENTER)
    $hButton = GUICtrlGetHandle($idButton)
    _GUICtrlStatusBar_EmbedControl($hStatus, 3, $hButton, 4)

    ; Loop until the user exits.
    Local $aMsg
    While 1
        $aMsg = GUIGetMsg(1)
        If $aMsg[0] <> 0 Then
            If $aMsg[0] = $idButton Then _ArrayDisplay($aMsg,'$aMsg $idButton')
            If $aMsg[2] = $hButton Then _ArrayDisplay($aMsg,'$aMsg $hButton')
            If $aMsg[1] = $hGUI Then
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE
                        ExitLoop
                EndSwitch
            EndIf
            If $aMsg[1] = $hStatus Then
                MsgBox(0, '', 'TEST $hStatus')
                Switch $aMsg[2]
                    Case $hButton
                        MsgBox(0, '', 'TEST')
                EndSwitch
            EndIf
        EndIf
    WEnd
    GUIDelete()
EndFunc   ;==>Example

But this do not work.

So I dig deeper in HelpFile Example for

_GUICtrlStatusBar_Create(....)

and I find something interesting , ..... modified, it , and:

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>


Global $iMemo, $MainGUI, $hStatus, $hButton, $idButton

Example()

Func Example()
    Local $hGUI
    Local $aParts[3] = [75, 150, -1]

    ; Create GUI
    $hGUI = GUICreate("(Example 1) StatusBar Create", 400, 300)

    ;===============================================================================
    ; defaults to 1 part, no text
    $hStatus = _GUICtrlStatusBar_Create($hGUI)
    ;===============================================================================
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)

    ; Create memo control
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
    GUICtrlSetBkColor($iMemo, 0xFFFFFF)
    GUISetState(@SW_SHOW)


    Local $aRect_stop = _GUICtrlStatusBar_GetRect($hStatus, 2)
    $idButton = GUICtrlCreateButton("Help", $aRect_stop[0] + 2, $aRect_stop[1] + 2, ($aRect_stop[2] - $aRect_stop[0]), 16, $BS_CENTER)
    $hButton = GUICtrlGetHandle($idButton)
    _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hButton, 4)

    MemoWrite("StatusBar Created with:" & @CRLF & _
            @TAB & "Handle to GUI window" & @CRLF)

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    ; Get border sizes
    MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz($hStatus))
    MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert($hStatus))
    MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect($hStatus))

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUISetState(@SW_ENABLE, $MainGUI)
    GUIDelete($hGUI)
EndFunc   ;==>Example

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Local $tinfo
    Switch $hWndFrom
        Case $hButton
            ConsoleWrite($iCode & @CRLF)
            Switch $iCode
                Case -12
                    MsgBox(0, '', '$hButton')
            EndSwitch
        Case $hStatus
            Switch $iCode
                Case $NM_CLICK ; The user has clicked the left mouse button within the control
                    $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
                    $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
                    $iIDFrom = DllStructGetData($tinfo, "IDFrom")
                    $iCode = DllStructGetData($tinfo, "Code")
                    _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @CRLF & _
                            "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @CRLF & _
                            "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @CRLF & _
                            "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @CRLF & _
                            "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
                    Return True ; indicate that the mouse click was handled and suppress default processing by the system
                    ; Return FALSE ;to allow default processing of the click.
                Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
                    $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
                    $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
                    $iIDFrom = DllStructGetData($tinfo, "IDFrom")
                    $iCode = DllStructGetData($tinfo, "Code")
                    _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @CRLF & _
                            "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @CRLF & _
                            "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @CRLF & _
                            "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @CRLF & _
                            "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
                    Return True ; indicate that the mouse click was handled and suppress default processing by the system
                    ; Return FALSE ;to allow default processing of the click.
                Case $NM_RCLICK ; The user has clicked the right mouse button within the control
                    $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
                    $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
                    $iIDFrom = DllStructGetData($tinfo, "IDFrom")
                    $iCode = DllStructGetData($tinfo, "Code")
                    _DebugPrint("$NM_RCLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @CRLF & _
                            "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @CRLF & _
                            "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @CRLF & _
                            "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @CRLF & _
                            "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
                    Return True ; indicate that the mouse click was handled and suppress default processing by the system
                    ; Return FALSE ;to allow default processing of the click.
                Case $NM_RDBLCLK ; The user has double-clicked the right mouse button within the control
                    $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
                    $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
                    $iIDFrom = DllStructGetData($tinfo, "IDFrom")
                    $iCode = DllStructGetData($tinfo, "Code")
                    _DebugPrint("$NM_RDBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @CRLF & _
                            "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @CRLF & _
                            "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @CRLF & _
                            "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @CRLF & _
                            "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
                    Return True ; indicate that the mouse click was handled and suppress default processing by the system
                    ; Return FALSE ;to allow default processing of the click.
                Case $SBN_SIMPLEMODECHANGE ; Simple mode changes
                    _DebugPrint("$SBN_SIMPLEMODECHANGE" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode)
                    ; No return value
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @CRLF & _
            "+======================================================" & @CRLF & _
            "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @CRLF & _
            "+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint

But with it I still have some issues.

so:

Why this part of script:

Case $hButton
            ConsoleWrite($iCode & @CRLF)
            Switch $iCode
                Case -12
                    MsgBox(0, '', '$hButton')
            EndSwitch

multiple times displays this MsgBox ?

EDIT: typo + vocabulary

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

I found solution by rover


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

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