AutoIt中的WM_GETMINMAXINFO

时间:2014-05-18 19:28:52

标签: windows winapi autoit

有没有办法通过AutoIt 发送 WM_GETMINMAXINFO消息,以确定窗口的最大和最小大小?我找不到任何使用PostMessage()发送struct的例子,虽然我不确定这是否相关。

1 个答案:

答案 0 :(得分:3)

这是我认为应该的。基于一些测试它似乎适用于某些窗口而不是其他窗口?不确定。但无论如何,这会创建结构,然后使用_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")))