找回密码
 加入
搜索
楼主: gapkiller

[AU3基础] 如何指定message box的坐标

 火... [复制链接]
发表于 2010-4-5 23:11:02 | 显示全部楼层
把画的写进函数里行吧
发表于 2010-7-10 14:02:42 | 显示全部楼层
回复 13# afan


    个个例子都很经典 学习
发表于 2010-7-10 15:48:47 | 显示全部楼层
有用,收了
发表于 2010-7-10 16:41:37 | 显示全部楼层
我是想说, 应该还是有办法来控制坐标的.
如果连续弹出两个msgbox, 那么第二个msgbox是不会重叠在一起的.
...
gapkiller 发表于 2010-3-13 08:25


这个没什么控制的,Windows的窗口机制本来就是这样。同样的窗口弹出多个默认会层叠,只是AU3不支持这种坐标模式你不知道而已。
发表于 2010-7-10 17:07:50 | 显示全部楼层
#include <WinAPI.au3>

$hGUI = GUICreate("", 400, 300)
GUICtrlCreateButton("Popup a MsgBox Window", 20, 40, 150, 20)
GUISetState(@SW_SHOW, $hGUI)

$hInst = _WinAPI_GetWindowLong($hGUI, -6)
$iThreadId = _WinAPI_GetCurrentThreadId()

$hCallBack = DllCallBackRegister("_CallBack", "int", "int;hWnd;ptr")
$pCallBack = DllCallBackGetPtr($hCallBack)

$hHook = _WinAPI_SetWindowsHookEx(5, $pCallBack, $hInst, $iThreadId)

While 1
        Switch GUIGetMsg()
        Case -3
                ExitLoop
        Case 3
                MsgBox(0, "Popup a MsgBox Window", "Locates at Left-top corner")
        EndSwitch
WEnd
GUIDelete($hGUI)
_WinAPI_UnhookWindowsHookEx($hHook)
DllCallBackFree($hCallBack)


Func _CallBack($iCode, $wParam, $lParam)
        If ($iCode = 5) And ($wParam <> $hGUI) Then
                WinMove($wParam, "", 0, 0, Default, Default)
        EndIf
        Return 0
EndFunc        ;==>_CallBack

评分

参与人数 3威望 +5 金钱 +70 贡献 +10 收起 理由
gapkiller + 40 + 10 感谢关注
afan + 5 学习了
水木子 + 30 相当厉害!

查看全部评分

发表于 2022-4-15 17:38:32 | 显示全部楼层
跟随主界面居中,改了个坐标,做个标记,方便日后学习。
WinMove($wParam, "", WinGetPos($hGUI)[0] + WinGetPos($hGUI)[2] / 2 - WinGetPos("Popup a MsgBox Window")[2] / 2, WinGetPos($hGUI)[1] + WinGetPos($hGUI)[3] / 2 - WinGetPos("Popup a MsgBox Window")[3] / 2, Default, Default)


您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-26 02:51 , Processed in 0.068993 second(s), 13 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表