forked from Tebayaki/AutoHotkeyScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMsgBoxAt.ahk
More file actions
21 lines (20 loc) · 896 Bytes
/
MsgBoxAt.ahk
File metadata and controls
21 lines (20 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* @Example MsgBoxAt(100, 100, "Content", "Title", "YesNo") */
MsgBoxAt(x, y, text?, title?, options?) {
if hHook := DllCall("SetWindowsHookExW", "int", 5, "ptr", cb := CallbackCreate(CBTProc), "ptr", 0, "uint", DllCall("GetCurrentThreadId", "uint"), "ptr") {
res := MsgBox(text ?? unset, title ?? unset, options ?? unset)
if hHook
DllCall("UnhookWindowsHookEx", "ptr", hHook)
}
CallbackFree(cb)
return res ?? ""
CBTProc(nCode, wParam, lParam) {
if nCode == 3 && WinGetClass(wParam) == "#32770" {
DllCall("UnhookWindowsHookEx", "ptr", hHook)
hHook := 0
pCreateStruct := NumGet(lParam, "ptr")
NumPut("int", x, pCreateStruct, 44)
NumPut("int", y, pCreateStruct, 40)
}
return DllCall("CallNextHookEx", "ptr", 0, "int", nCode, "ptr", wParam, "ptr", lParam)
}
}