Reputation: 642
Is there a way to send the WM_GETMINMAXINFO
message via AutoIt, in order to determine a window's maximum and minimum size? I can't find any examples of using PostMessage() to send a struct
, although I'm not sure if that's relevant.
Upvotes: 0
Views: 315
Reputation: 7160
This is what I think it should be. Based on a few tests it seems to work for some windows and not others? Not sure. But anyway, this creates the structure, and then uses _SendMessage
.
#include <WindowsConstants.au3>
#include <SendMessage.au3>
Global Const $tagMINMAXINFO = "struct;long;long;endstruct;" & _
"struct;long MaxSizeX;long MaxSizeY;endstruct;" & _
"struct;long MaxPositionX;long MaxPositionY;endstruct;" & _
"struct;long MinTrackSizeX;long MinTrackSizeY;endstruct;" & _
"struct;long MaxTrackSizeX;long MaxTrackSizeY;endstruct;"
Local $tMMI = DllStructCreate($tagMINMAXINFO)
_SendMessage(WinGetHandle("Test"), $WM_GETMINMAXINFO, 0, $tMMI, 0, "wparam", "struct*")
ConsoleWrite(StringFormat("Max Size: %ix%i\n", DllStructGetData($tMMI, "MaxSizeX"), DllStructGetData($tMMI, "MaxSizeY")))
ConsoleWrite(StringFormat("Max Position: %ix%i\n", DllStructGetData($tMMI, "MaxPositionX"), DllStructGetData($tMMI, "MaxPositionY")))
ConsoleWrite(StringFormat("Min Track Size: %ix%i\n", DllStructGetData($tMMI, "MinTrackSizeX"), DllStructGetData($tMMI, "MinTrackSizeY")))
ConsoleWrite(StringFormat("Max Track Size: %ix%i\n", DllStructGetData($tMMI, "MaxTrackSizeX"), DllStructGetData($tMMI, "MaxTrackSizeY")))
Upvotes: 3