name22

Register WM_MOVE - Get Window Coordinates

Oct 31st, 2012
159
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <GUIConstants.au3>
  2. #include <WinAPI.au3>
  3. #include <WindowsConstants.au3>
  4.  
  5. $hWnd = GUICreate("Move Test", 200, 100)
  6. $cLabel_X = GUICtrlCreateLabel("", 10, 10, 90, 20)
  7. $cLabel_Y = GUICtrlCreateLabel("", 100, 10, 90, 20)
  8. GUISetState()
  9.  
  10. GUIRegisterMsg($WM_MOVE, "_WM_MOVE")
  11.  
  12. While GUIGetMsg() <> -3
  13. WEnd
  14.  
  15. Func _WM_MOVE($hWnd, $Msg, $wParam, $lParam)
  16.     Local $iX = _WinAPI_LoWord($lParam)
  17.     Local $iY = _WinAPI_HiWord($lParam)
  18.     GUICtrlSetData($cLabel_X, $iX)
  19.     GUICtrlSetData($cLabel_Y, $iY)
  20. EndFunc
RAW Paste Data