Sign in to follow this  
Followers 0
GaryFrost

WM_SYSCOMMAND

1 post in this topic

Was actually trying to find something else and came across this, someone might find it usefull.

#include <GUIConstants.au3>

Global Const $WM_SYSCOMMAND = 0x112;
Global Const $SC_CLOSE = 0xF060;
Global Const $SC_CONTEXTHELP = 0xF180;
Global Const $SC_DEFAULT = 0xF160;
Global Const $SC_HOTKEY = 0xF150;
Global Const $SC_KEYMENU = 0xF100;
Global Const $SC_MAXIMIZE = 0xF030;
Global Const $SC_MINIMIZE = 0xF020;
Global Const $SC_MONITORPOWER = 0xF170;
Global Const $SC_MOUSEMENU = 0xF090;
Global Const $SC_MOVE = 0xF010;
Global Const $SC_NEXTWINDOW = 0xF040;
Global Const $SC_PREVWINDOW = 0xF050;
Global Const $SC_RESTORE = 0xF120;
Global Const $SC_SCREENSAVE = 0xF140;
Global Const $SC_SIZE = 0xF000;
Global Const $SC_TASKLIST = 0xF130;
Global Const $SC_VSCROLL = 0xF070;


;~ GUICreate("My GUI",500,500,Default,Default,BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))  ; will create a dialog box that when displayed is centered
GUICreate("My GUI",500,500,Default,Default,BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX),$WS_EX_CONTEXTHELP)  ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)       ; will display an empty dialog box
GUIRegisterMsg($WM_SYSCOMMAND,"WM_SYSCOMMAND_Events")

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Func WM_SYSCOMMAND_Events($hWndGUI, $MsgID, $wParam, $lParam)
    Switch $wParam
        Case $SC_CLOSE
            _DebugPrint("$SC_CLOSE")
        Case $SC_CONTEXTHELP
            _DebugPrint("$SC_CONTEXTHELP")
        Case $SC_DEFAULT
            _DebugPrint("$SC_DEFAULT")
        Case $SC_HOTKEY
            _DebugPrint("$SC_HOTKEY")
        Case $SC_KEYMENU
            _DebugPrint("$SC_KEYMENU")
        Case $SC_MAXIMIZE
            _DebugPrint("$SC_MAXIMIZE")
        Case $SC_MINIMIZE
            _DebugPrint("$SC_MINIMIZE")
        Case $SC_MONITORPOWER
            _DebugPrint("$SC_MONITORPOWER")
        Case $SC_MOUSEMENU
            _DebugPrint("$SC_MOUSEMENU")
        Case $SC_MOVE
            _DebugPrint("$SC_MOVE")
        Case $SC_NEXTWINDOW
            _DebugPrint("$SC_NEXTWINDOW")
        Case $SC_PREVWINDOW
            _DebugPrint("$SC_PREVWINDOW")
        Case $SC_RESTORE
            _DebugPrint("$SC_RESTORE")
        Case $SC_SCREENSAVE
            _DebugPrint("$SC_SCREENSAVE")
        Case $SC_SIZE
            _DebugPrint("$SC_SIZE")
        Case $SC_TASKLIST
            _DebugPrint("$SC_CLOSE")
        Case $SC_VSCROLL
            _DebugPrint("$SC_VSCROLL")
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Func _HiWord($x)
    Return BitShift($x, 16)
EndFunc   ;==>_HiWord 

Func _LoWord($x)
    Return BitAND($x, 0xFFFF)
EndFunc   ;==>_LoWord 

Func _DebugPrint($s_text)
    $s_text = StringReplace(StringReplace($s_text, @CRLF, @LF), @LF, @LF & "!-->")
    ConsoleWrite( _
            "+===========================================================" & @LF & _
            "!-->" & $s_text & @LF & _
            "+===========================================================" & @LF & @LF)
EndFunc   ;==>_DebugPrint

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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