Sign in to follow this  
Followers 0
money

WM_SIZING Example

2 posts in this topic

http://msdn.microsoft.com/en-us/library/windows/desktop/ms632647%28v=vs.85%29.aspx

WM_SIZING Example

; WM_SIZING: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632647%28v=vs.85%29.aspx
; RECT Struct: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162897%28v=vs.85%29.aspx
; Minimum: Windows 2000 Professional

; WM_SIZING Example by money

Global Const $WMSZ_LEFT         = 1
Global Const $WMSZ_RIGHT         = 2
Global Const $WMSZ_TOP             = 3
Global Const $WMSZ_TOPLEFT         = 4
Global Const $WMSZ_TOPRIGHT     = 5
Global Const $WMSZ_BOTTOM         = 6
Global Const $WMSZ_BOTTOMLEFT     = 7
Global Const $WMSZ_BOTTOMRIGHT     = 8
;~ Global Const $WM_SIZING         = 0x0214 ; included in WindowsConstants.au3

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

Global $hGUI, $gcSizingFrom, $gcSizingCoord

_Main()

Func _Main()
    $hGUI = GUICreate("$WM_SIZING Example", 407, 298, -1, -1, BitOr($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $WS_EX_TOPMOST)
    $gcSizingFrom = GUICtrlCreateLabel("Resizing from: None", 16, 24, 300, 17)
    $gcSizingCoord = GUICtrlCreateLabel("Coordinates: None", 16, 56, 300, 17)
    GUICtrlSetResizing($gcSizingFrom, $GUI_DOCKALL)
    GUICtrlSetResizing($gcSizingCoord , $GUI_DOCKALL)
    GUIRegisterMsg($WM_SIZING, "WM_SIZING")
    GUISetState(@SW_SHOW)
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc

Func WM_SIZING($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam, $ilParam

    ; A pointer to a RECT structure with the screen coordinates of the drag rectangle
    ; To change the size or position of the drag rectangle, an application must change the members of this structure.
    Local $tRECT = DllStructCreate("int;int;int;int", $ilParam) ; $tagRECT
    Local $iLeft, $iTop, $iRight, $iBottom
    $iLeft = DllStructGetData($tRECT, 1)
    $iTop = DllStructGetData($tRECT, 2)
    $iRight = DllStructGetData($tRECT, 3)
    $iBottom = DllStructGetData($tRECT, 4)

;~     ;  Uncomment this line have the window stretched to desktop width
;~     DllStructSetData($tRECT, 1, 0) ;left
;~     DllStructSetData($tRECT, 3, @DesktopWidth) ;right

    $tRECT = 0

    GUICtrlSetData($gcSizingCoord, StringFormat("Coordinates: ( Left: %d, Top: %d, Right: %d, Bottom: %d )", $iLeft, $iTop, $iRight, $iBottom))

    ; The edge of the window that is being sized
    Switch BitAND($iwParam, 0xFFFF) ; LoWord
        Case $WMSZ_LEFT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Left")
        Case $WMSZ_RIGHT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Right")
        Case $WMSZ_TOP
            GUICtrlSetData($gcSizingFrom, "Resizing from: Top")
        Case $WMSZ_TOPLEFT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Top-left")
        Case $WMSZ_TOPRIGHT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Top-right")
        Case $WMSZ_BOTTOM
            GUICtrlSetData($gcSizingFrom, "Resizing from: Bottom")
        Case $WMSZ_BOTTOMLEFT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Bottom-left")
        Case $WMSZ_BOTTOMRIGHT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Bottom-right")
        Case Else
            GUICtrlSetData($gcSizingFrom, "Resizing from: Nsone")
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc

Maybe someone can find something more exciting to do with this

Share this post


Link to post
Share on other sites



http://msdn.microsoft.com/en-us/library/windows/desktop/ms632647%28v=vs.85%29.aspx

WM_SIZING Example

; WM_SIZING: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632647%28v=vs.85%29.aspx
; RECT Struct: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162897%28v=vs.85%29.aspx
; Minimum: Windows 2000 Professional
 
; WM_SIZING Example by money
 
Global Const $WMSZ_LEFT      = 1
Global Const $WMSZ_RIGHT         = 2
Global Const $WMSZ_TOP           = 3
Global Const $WMSZ_TOPLEFT       = 4
Global Const $WMSZ_TOPRIGHT  = 5
Global Const $WMSZ_BOTTOM        = 6
Global Const $WMSZ_BOTTOMLEFT    = 7
Global Const $WMSZ_BOTTOMRIGHT   = 8
;~ Global Const $WM_SIZING       = 0x0214 ; included in WindowsConstants.au3
 
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
 
Global $hGUI, $gcSizingFrom, $gcSizingCoord
 
_Main()
 
Func _Main()
    $hGUI = GUICreate("$WM_SIZING Example", 407, 298, -1, -1, BitOr($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $WS_EX_TOPMOST)
    $gcSizingFrom = GUICtrlCreateLabel("Resizing from: None", 16, 24, 300, 17)
    $gcSizingCoord = GUICtrlCreateLabel("Coordinates: None", 16, 56, 300, 17)
    GUICtrlSetResizing($gcSizingFrom, $GUI_DOCKALL)
    GUICtrlSetResizing($gcSizingCoord , $GUI_DOCKALL)
    GUIRegisterMsg($WM_SIZING, "WM_SIZING")
    GUISetState(@SW_SHOW)
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc
 
Func WM_SIZING($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam, $ilParam
 
    ; A pointer to a RECT structure with the screen coordinates of the drag rectangle
    ; To change the size or position of the drag rectangle, an application must change the members of this structure.
    Local $tRECT = DllStructCreate("int;int;int;int", $ilParam) ; $tagRECT
    Local $iLeft, $iTop, $iRight, $iBottom
    $iLeft = DllStructGetData($tRECT, 1)
    $iTop = DllStructGetData($tRECT, 2)
    $iRight = DllStructGetData($tRECT, 3)
    $iBottom = DllStructGetData($tRECT, 4)
 
;~   ;  Uncomment this line have the window stretched to desktop width
;~   DllStructSetData($tRECT, 1, 0) ;left
;~   DllStructSetData($tRECT, 3, @DesktopWidth) ;right
 
    $tRECT = 0
 
    GUICtrlSetData($gcSizingCoord, StringFormat("Coordinates: ( Left: %d, Top: %d, Right: %d, Bottom: %d )", $iLeft, $iTop, $iRight, $iBottom))
 
    ; The edge of the window that is being sized
    Switch BitAND($iwParam, 0xFFFF) ; LoWord
        Case $WMSZ_LEFT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Left")
        Case $WMSZ_RIGHT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Right")
        Case $WMSZ_TOP
            GUICtrlSetData($gcSizingFrom, "Resizing from: Top")
        Case $WMSZ_TOPLEFT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Top-left")
        Case $WMSZ_TOPRIGHT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Top-right")
        Case $WMSZ_BOTTOM
            GUICtrlSetData($gcSizingFrom, "Resizing from: Bottom")
        Case $WMSZ_BOTTOMLEFT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Bottom-left")
        Case $WMSZ_BOTTOMRIGHT
            GUICtrlSetData($gcSizingFrom, "Resizing from: Bottom-right")
        Case Else
            GUICtrlSetData($gcSizingFrom, "Resizing from: Nsone")
    EndSwitch
 
    Return $GUI_RUNDEFMSG
EndFunc

Maybe someone can find something more exciting to do with this

Nice Example

Thanks :graduated:


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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