Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
CallWndProc(nCode, wParam, lParam)
{
Critical 666
global vJeeInputBoxHFont
if (nCode >= 0) { ; HC_ACTION
;cwplParam := NumGet(lParam+0) ; type is dependent on cwpmessage
;cwpwParam := NumGet(lParam+0, A_PtrSize)
cwpmessage := NumGet(lParam+0, A_PtrSize * 2, "UInt")
hWnd := NumGet(lParam+0, A_PtrSize * 3, "Ptr")
WinGetClass hwndClass, ahk_id %hWnd%
if (hwndClass == "#32770") {
propHandle := DllCall("GetProp", "Ptr", hwnd, "Str", "hookSentinel", "Ptr")
if (cwpmessage == 0x007F && !propHandle) {
DllCall("SetProp", "Ptr", hWnd, "Str", "hookSentinel", "Ptr", True)
if (!vJeeInputBoxHFont) {
vFontName := "Arial"
vFontSize := 20
vFontWeight := 400
vFontHeight := -Round(vFontSize*A_ScreenDPI/72)
vJeeInputBoxHFont := DllCall("CreateFont", Int,vFontHeight, Int,0, Int,0, Int,0
, Int,vFontWeight, UInt,0, UInt,0 ,UInt,0
, UInt,0, UInt,0, UInt,0, UInt,0
, UInt,0, Str,vFontName,"Ptr")
}
WinSet, AlwaysOnTop, On, ahk_id %hWnd%
PostMessage, 0x30, % vJeeInputBoxHFont, 0, Static1, ahk_id %hWnd% ;WM_SETFONT
PostMessage, 0x30, % vJeeInputBoxHFont, 0, Edit1, ahk_id %hWnd% ;WM_SETFONT
PostMessage, 0x30, % vJeeInputBoxHFont, 0, Button1, ahk_id %hWnd% ;WM_SETFONT
PostMessage, 0x30, % vJeeInputBoxHFont, 0, Button2, ahk_id %hWnd% ;WM_SETFONT
ControlGetPos, vPosX, vPosY, vPosW, vPosH, Edit1, ahk_id %hWnd%
ControlMove, Edit1, % vPosX, % vPosY-20, % vPosW, % vPosH+20, ahk_id %hWnd%
ControlGetPos, vPosX, vPosY, vPosW, vPosH, Button1, ahk_id %hWnd%
ControlMove, Button1, % vPosX-20, % vPosY-5, % vPosW+40, % vPosH+10, ahk_id %hWnd%
ControlGetPos, vPosX, vPosY, vPosW, vPosH, Button2, ahk_id %hWnd%
ControlMove, Button2, % vPosX-20, % vPosY-5, % vPosW+40, % vPosH+10, ahk_id %hWnd%
ControlGetPos, vPosX, vPosY, vPosW, vPosH, Static1, ahk_id %hWnd%
ControlMove, Static1, % vPosX, % vPosY, % vPosW, % vPosH-20, ahk_id %hWnd%
vPosX := 448, vPosY := 238, vPosW := 384, vPosH := 204
WinMove, ahk_id %hWnd%, , % vPosX, % vPosY, % vPosW, % vPosH
} else if (cwpmessage == 0x0082 && propHandle) {
DllCall("RemoveProp", "Ptr", hWnd, "Str", "hookSentinel")
}
}
}
return DllCall("CallNextHookEx", "ptr", 0, "Int", nCode, "Ptr", wParam, "Ptr", lParam, "Ptr")
}
AtExit()
{
global wndhook, wndlpfn
if (wndhook)
DllCall("UnhookWindowsHookEx", "Ptr", wndhook), wndhook := 0
if (wndlpfn)
DllCall("GlobalFree", "Ptr", wndlpfn, "Ptr"), wndlpfn := 0
return 0
}
OnExit("AtExit")
q::
Thread, Priority, 2
DetectHiddenWindows, On
SplitPath, A_ScriptName, , , , vNameNoExt
vJeeInputBoxTitle := vNameNoExt
if (!wndhook)
wndhook := DllCall("SetWindowsHookEx", "Int", WH_CALLWNDPROC := 4, "Ptr", wndlpfn := RegisterCallback("CallWndProc", ""), "Ptr", 0, "UInt", DllCall("GetCurrentThreadId", "UInt"), "Ptr")
InputBox, vInput, % vJeeInputBoxTitle, % "prompt", , , , , , , , % "default"
Return