Jump to content

Recommended Posts

Posted

@azjio

Nice, I like the GUI interface for showing the commands for the controls used. Very handy.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

  On 2/21/2012 at 7:34 PM, 'Chad2 said:

Just to be clear on the blocking function. Does this only have to do with loops or blocks like msgbox inside the result of a registerMsg.

Blocking means that you don't return from the function, which means that you are blocking with _aboutPage() here. You must make it Return in a timely manner or you will get trouble.
  • 1 month later...
  • 8 months later...
Posted (edited)

Maybe replacing the 'magic numbers' would be a good option.

Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

The OP code has been updated to remove all "magic numbers" and they have been replaced with the actual Windows constants that should be used.

Unfortunately, there is no listing for the codes returned when clicking on the sides/bottom/corner of the GUI when you're resizing it, so I took the only documented variable that was found and added the difference to that variable to get the correct number. If anyone knows what the documented variable names are for those messages returned by those actions, please let me know so I can update the code.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

  • 1 year later...
Posted

  On 2/21/2012 at 8:57 PM, AZJIO said:

BrewManNH

WM_Ru.7z - 70 files. I hope it will be interesting to see.

 

link points to a deleted file

is it there a new one please?

thanks

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

  • 2 months later...
Posted
  On 5/5/2014 at 9:13 AM, AZJIO said:

I am often asked this file, so I recently made a reference constant. The problem may be due to the server.

 

Link now is OK

(and content of file is OK too.... :thumbsup: )

Thanks

Bye

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

  • 1 month later...
Posted

I am revisiting this topic as it came up a couple of times in posts recently. I ran the code from the original post on Windows 7 x64 and the window sizing commands didn't appear to be detected as the same values as they were when I wrote this. Can someone test this code on various versions of Windows and let me know if anything is working incorrectly? I only have access to Windows 7 x64 machines these days so I can't really test it reliably except on this computer.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

MsgBox(0, "MY_WM_COMMAND", "GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                            "MsgID" & @TAB & ":" & $msg & @LF & _

$msg 

or 

$iMsg ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I'm guessing that was supposed to be $iMsg.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

When you return 0

Case $SC_MOVE
                    ConsoleWrite("!System menu Move Option pressed" & @LF)
                    Return 0

then you can not move window

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

here is what I got after some testing and modyfication

I replace Consolewrite with TrayTip - to test on compiled version

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MenuConstants.au3>

Global $_hGUI, $_iButton1, $_iButton2, $_iSlider, $_hSlider
Global $_fExit = False

MakeGui()

While 1
    Sleep(10)
    If $_fExit Then
        DeleteGui()
        Exit
    EndIf
WEnd

Func MakeGui()

    $_hGUI = GUICreate("Test GUI", 200, 200, -1, -1, BitOR($WS_THICKFRAME, $GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MAXIMIZEBOX))
    $_iButton1 = GUICtrlCreateButton("Test 1", 20, 20)
    $_iButton2 = GUICtrlCreateButton("Another Test2", 20, 100)
    $_iSlider = GUICtrlCreateSlider(20, 60, 150)
    $_hSlider = GUICtrlGetHandle($_iSlider)
    GUIRegisterMsg($WM_COMMAND, "_WM_EXTRACTOR")
    GUIRegisterMsg($WM_SYSCOMMAND, "_WM_EXTRACTOR")
    GUIRegisterMsg($WM_HSCROLL, "_WM_EXTRACTOR")
    GUISetState()

EndFunc   ;==>MakeGui

Func DeleteGui()
    GUIDelete($_hGUI)
EndFunc   ;==>DeleteGui

Func _WM_EXTRACTOR($hWnd, $iMsg, $wParam, $lParam)

    If $hWnd = $_hGUI Then
        Local $nNotifyCode = BitShift($wParam, 16)
        Local $nID = BitAND($wParam, 0x0000FFFF)
        Local $hCtrl = $lParam
        #forceref $hWnd, $iMsg, $wParam, $lParam
        Switch $iMsg
            Case $WM_HSCROLL
                Switch $lParam

                    Case $_hSlider
                        TrayTip("Testing $WM_HSCROLL : $_hSlider", _
                                "Slider moved to: " & GUICtrlRead($_iSlider) & @LF & _
                                "-----------------------------" & @LF & _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_HSCROLL - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)

                    Case Else
                        TrayTip("Testing", "$WM_HSCROLL:  ", 10)

                EndSwitch ; $lParam
            Case $WM_VSCROLL

            Case $WM_COMMAND
                Switch $nID

                    Case $_iButton1
                        TrayTip("Testing $WM_COMMAND : Button 'Test1' pressed", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_COMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)


                    Case $_iButton2
                        TrayTip("Testing $WM_COMMAND : Button 'Another Test2' pressed", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_COMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)


                    Case Else
                        TrayTip("Testing $WM_COMMAND : Case Else", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_COMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)

                        MsgBox(0, "MY_WM_COMMAND : Case Else", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_COMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl)

                EndSwitch ; $nID

            Case $WM_SYSCOMMAND
                Local $test = BitAND($wParam, 0xFFF0)

                Switch $test

                    Case $SC_CLOSE
                        TrayTip("Testing $WM_SYSCOMMAND", "Exit pressed", 10)
                        MsgBox(0, "$WM_SYSCOMMAND : $SC_CLOSE", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl)
                        $_fExit = True

                    Case $SC_CONTEXTHELP
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_CONTEXTHELP", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)

                    Case $SC_DEFAULT
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_DEFAULT", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)

                    Case $SC_HOTKEY
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_HOTKEY", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)


                    Case $SC_HSCROLL
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_HSCROLL", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)


                    Case $SC_KEYMENU
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_KEYMENU", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)


                    Case $SC_MAXIMIZE
                        TrayTip("Testing $WM_SYSCOMMAND : Maximize Window ($SC_MAXIMIZE)", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)

                    Case $SC_MINIMIZE
                        TrayTip("Testing $WM_SYSCOMMAND : Minimize Window ($SC_MINIMIZE)", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)

                    Case $SC_MONITORPOWER
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_MONITORPOWER", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)


                    Case $SC_MOUSEMENU
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_MOUSEMENU", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)


                    Case $SC_MOVE
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_MOVE", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)
;~                      Return 0

                    Case $SC_NEXTWINDOW
                        TrayTip("Testing $WM_SYSCOMMAND", "$SC_NEXTWINDOW", 10)

                    Case $SC_PREVWINDOW
                        TrayTip("Testing $WM_SYSCOMMAND", "$SC_PREVWINDOW", 10)

                    Case $SC_RESTORE
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_RESTORE", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)
                    Case $SC_SCREENSAVE
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_SCREENSAVE", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)
                    Case $SC_SIZE
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_SIZE", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)
;~                      Return 0

                    Case $SC_TASKLIST
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_TASKLIST", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)

                    Case $SC_VSCROLL
                        TrayTip("Testing $WM_SYSCOMMAND : $SC_VSCROLL", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl, 10)

                    Case $SC_MOUSEMENU + 3
                        TrayTip("Testing $WM_SYSCOMMAND", "System menu pressed", 10)

                    Case $SC_MOUSEMENU + 2 ; This and the following case statements are only valid when the GUI is resizable
                        TrayTip("Testing $WM_SYSCOMMAND", "Right side of GUI clicked", 10)
;~                      Return 0

                    Case $SC_MOUSEMENU + 1
                        TrayTip("Testing $WM_SYSCOMMAND", "Left side of GUI clicked", 10)
;~                      Return 0

                    Case $SC_MOUSEMENU + 8
                        TrayTip("Testing $WM_SYSCOMMAND", "Lower Right corner of GUI clicked", 10)
;~                      Return 0

                    Case $SC_MOUSEMENU + 7
                        TrayTip("Testing $WM_SYSCOMMAND", "Lower Left corner of GUI clicked", 10)
;~                      Return 0

                    Case $SC_MOUSEMENU + 6
                        TrayTip("Testing $WM_SYSCOMMAND", "Bottom side of GUI clicked", 10)
;~                      Return 0

                    Case Else
                        TrayTip("Testing", "$WM_SYSCOMMAND:  ", 10)
                        MsgBox(0, "$WM_SYSCOMMAND", _
                                "$hWnd = GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                "$MsgID" & @TAB & ":" & $iMsg & @LF & _
                                "$wParam" & @TAB & ":" & $wParam & @LF & _
                                "$lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                "WM_SYSCOMMAND - Infos:" & @LF & _
                                "-----------------------------" & @LF & _
                                "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                "CtrlID" & @TAB & ":" & $nID & @LF & _
                                "CtrlHWnd" & @TAB & ":" & $hCtrl)

                EndSwitch ; $test

        EndSwitch ; $iMsg
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_EXTRACTOR

EDIT: script modyfication

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

My question wasn't in how to extend the demo, my question was do the values still work for resizing? That's all I need to know, and anything else is nice to have, but irrelevant to the quesion I have.

EDIT: BTW, I intentionally disabled moving and resizing the window by returning 0, it's a demo to show how to use GUIRegisterMsg in a script, not a GUI that I expect anyone to use.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

The $SC_MOUSEMENUs aren't picked up in Windows 8.1 64-bit.

Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Seems like they've changed since I wrote this,I think it was originally written on an XP machine.

Here's a version that correctly identifies the clicks on the borders and all 4 corners as well as the title bar.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MenuConstants.au3>
GUIRegisterMsg($WM_COMMAND, "_WM_EXTRACTOR")
GUIRegisterMsg($WM_SYSCOMMAND, "_WM_EXTRACTOR")
GUIRegisterMsg($WM_HSCROLL, "_WM_EXTRACTOR")
$GUI = GUICreate("Test GUI", 200, 200, -1, -1, BitOR($WS_THICKFRAME, $gui_ss_default_gui))
$Button = GUICtrlCreateButton("Test", 20, 20)
$Button2 = GUICtrlCreateButton(" Another Test ", 20, 100)
$Slider = GUICtrlCreateSlider(20, 60, 150)
$hSlider = GUICtrlGetHandle($Slider)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $Button
            MsgBox(0, "", "You pressed the button marked TEST")
        Case $Button2
            MsgBox(0, "", "You pressed the button marked 'Another Test'")
    EndSwitch
WEnd
Func _WM_EXTRACTOR($hWnd, $iMsg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam, 16)
    Local $nID = BitAND($wParam, 0x0000FFFF)
    Local $hCtrl = $lParam
    Local $nCommand = BitAND($wParam, 0x000f)
    $wParam1 = BitAND($wParam, 0xfff0)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Switch $iMsg
        Case $WM_HSCROLL
            Switch $lParam
                Case $hSlider
                    ConsoleWrite("+Slider moved to: " & GUICtrlRead($Slider) & @LF)
            EndSwitch
        Case $WM_VSCROLL
        Case $WM_COMMAND
            Switch $nID
                Case $Button
                    ConsoleWrite(">Button Test pressed" & @LF)
                Case $Button2
                    ConsoleWrite(">Button Another Test pressed" & @LF)
                Case Else
                    MsgBox(0, "WM_COMMAND", "GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                            "MsgID" & @TAB & ":" & $iMsg & @LF & _
                            "wParam" & @TAB & ":" & $wParam & @LF & _
                            "lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                            "WM_COMMAND - Infos:" & @LF & _
                            "-----------------------------" & @LF & _
                            "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                            "CtrlID" & @TAB & ":" & $nID & @LF & _
                            "CtrlHWnd" & @TAB & ":" & $hCtrl)
            EndSwitch
        Case $WM_SYSCOMMAND
            Switch $wParam
                Case $SC_CLOSE
                    ConsoleWrite("!Exit pressed" & @LF)
                    Exit
                Case $SC_RESTORE
                    ConsoleWrite("!Restore window" & @LF)
                Case $SC_MINIMIZE
                    ConsoleWrite("!Minimize Window" & @LF)
                Case $SC_MOUSEMENU + 3
                    ConsoleWrite("!System menu pressed" & @LF)
                Case $SC_MOVE
                    ConsoleWrite("!System menu Move Option pressed" & @LF)
                    Return 0
                Case $SC_MOVE + 2
                    ConsoleWrite("!Title bar clicked" & @LF)
                Case $SC_SIZE
                    ConsoleWrite("!System menu Size Option pressed" & @LF)
                Case Else
                    Switch ($wParam - $wParam1)
                        Case 1
                            ConsoleWrite("!Left side of GUI clicked" & @LF)
                        Case 2; This and the following case statements are only valid when the GUI is resizable
                            ConsoleWrite("!Right side of GUI clicked" & @LF)
                        Case 3
                            ConsoleWrite("!Top border clicked" & @LF)
                        Case 4
                            ConsoleWrite("!Top Left corner of GUI clicked" & @LF)
                        Case 5
                            ConsoleWrite("!Top Right corner of GUI clicked" & @LF)
                        Case 6
                            ConsoleWrite("!Bottom side of GUI clicked" & @LF)
                        Case 7
                            ConsoleWrite("!Lower Left corner of GUI clicked" & @LF)
                        Case 8
                            ConsoleWrite("!Lower Right corner of GUI clicked" & @LF)
                        Case Else
                            MsgBox(0, "WM_SYSCOMMAND", "GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
                                    "MsgID" & @TAB & ":" & $iMsg & @LF & _
                                    "wParam" & @TAB & ":" & $wParam & @LF & _
                                    "lParam" & @TAB & ":" & $lParam & @LF & @LF & _
                                    "WM_COMMAND - Infos:" & @LF & _
                                    "-----------------------------" & @LF & _
                                    "Code" & @TAB & ":" & $nNotifyCode & @LF & _
                                    "CtrlID" & @TAB & ":" & $nID & @LF & _
                                    "CtrlHWnd" & @TAB & ":" & $hCtrl)
                    EndSwitch

            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_EXTRACTOR

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

It works now.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)

click on window borders are not detected on win7 x64.
They are instead detected on "Windows Virtual PC - XP Mode" (running on win7 x64)

anyway, also if the border click is detected, also if you drag the mouse no resizing of the window is performed.

EDIT:

I was testing your code from post #4 and in the while there were 2 new posts.

new code from post# 37 works on win7 x64

edit2:

and also works on "Windows Virtual PC - XP Mode" (running on win7 x64)

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...