JakeJohnson74 Posted February 12, 2015 Posted February 12, 2015 (edited) I am having some trouble dealing with the unsigned integer being returned by this message. I am looking at the flags parameter on MSDN and I need to convert that Uint to Hex in a way that outputs the value so it will match the format shown in the description the MSDN gives. Here is the link to the Message: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632612%28v=vs.85%29.aspx and here is my example: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> GUIRegisterMsg($WM_WINDOWPOSCHANGED, "_WM_WINDOWPOSCHANGED") $hgui = GUICreate("test", 300, 300, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_POPUP)) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func _WM_WINDOWPOSCHANGED($hWnd, $msg, $wParam, $lParam) Local $winpos_Struct = DllStructCreate("hwnd hwnd;hwnd hwndInsertAfter;int x;int y;int cx;int cy;uint flags", $lParam) ConsoleWrite("+ Position Changed to: -" & @LF) ConsoleWrite("hwnd: " & DllStructGetData($winpos_Struct, "hwnd") & @LF) ConsoleWrite("hwndafter: " & DllStructGetData($winpos_Struct, "hwndInsertAfter") & @LF) ConsoleWrite("x: " & DllStructGetData($winpos_Struct, "x") & @LF) ConsoleWrite("y: " & DllStructGetData($winpos_Struct, "y") & @LF) ConsoleWrite("cx: " & DllStructGetData($winpos_Struct, "cx") & @LF) ConsoleWrite("cy: " & DllStructGetData($winpos_Struct, "cy") & @LF) ConsoleWrite("flag: " & DllStructGetData($winpos_Struct, "flags") & @LF) EndFunc Any Advice would be helpful! ***Edit I should have mentioned that the flag can hold one or more members. So I am not sure how I should handle this. This is where my confusion is. Edited February 12, 2015 by JakeKenmode
Danyfirex Posted February 12, 2015 Posted February 12, 2015 If a got that you want. maybe using bitwise you can get it. flags=bitor(SWP_HIDEWINDOW,SWP_NOMOVE) bitand(flags,SWP_HIDEWINDOW) returns SWP_HIDEWINDOW Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
JakeJohnson74 Posted February 12, 2015 Author Posted February 12, 2015 Thanks Here is the working code. expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> GUIRegisterMsg($WM_WINDOWPOSCHANGING, "_WM_WINDOWPOSCHANGING") ;WINDOWPOS Contants ;~ Const $SWP_NOSIZE = 0x0001 ;~ Const $SWP_NOMOVE = 0x0002 ;~ Const $SWP_NOZORDER = 0x0004 ;~ Const $SWP_NOREDRAW = 0x0008 ;~ Const $SWP_NOACTIVATE = 0x0010 ;~ Const $SWP_FRAMECHANGED = 0x0020 ;~ Const $SWP_SHOWWINDOW = 0x0040 ;~ Const $SWP_HIDEWINDOW = 0x0080 ;~ Const $SWP_NOCOPYBITS = 0x0100 ;~ Const $SWP_NOREPOSITION = 0x0200 ;~ Const $SWP_NOSENDCHANGING = 0x0400 $hgui = GUICreate("test", 300, 300, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_POPUP)) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func _WM_WINDOWPOSCHANGING($hWnd, $msg, $wParam, $lParam) Local $winpos_Struct = DllStructCreate("hwnd hwnd;hwnd hwndInsertAfter;int x;int y;int cx;int cy;uint flags", $lParam) $AboutToMaximizeOrRestore = bitand(DllStructGetData($winpos_Struct, "flags"), $SWP_FRAMECHANGED) if (hex($AboutToMaximizeOrRestore)) > 0 then ConsoleWrite("+ About to Change Maximize or restore -" & @LF) endif EndFunc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now