Code:
#SingleInstance force
Gui, +LastFound +Resize
Gui, Show, w350 h500, Gmail Tasks via AHK
mgh := WinExist()
OnMessage(WM_KEYDOWN:=0x0100, "WM_KEYDOWN")
OnMessage(WM_KEYUP:=0x0101, "WM_KEYDOWN")
COM_AtlAxWinInit()
pwb := COM_AtlAxCreateControl(mgh, "Shell.Explorer")
pipa := COM_QueryInterface(pwb, "{00000117-0000-0000-C000-000000000046}")
COM_Invoke(pwb, "Navigate","https://mail.google.com/tasks/ig")
return
GuiClose:
Gui, Destroy
COM_Release(pipa)
COM_Release(pwb)
COM_AtlAxWinTerm()
ExitApp
WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
; backspace tab enter delete up down
If (wParam = 0x8 || wParam = 0x09 || wParam = 0x0D || wParam = 0x2E || wParam = 0x26 || wParam = 0x28)
{
WinGetClass, Class, ahk_id %hWnd%
If (Class = "Internet Explorer_Server")
{
Global pipa
VarSetCapacity(Msg, 28)
NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12)
NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
OutputDebug, % wParam " : " DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
Return 0
}
}
}
I added the extra OnMessage and an OutputDebug for the DllCAll.
Interestingly, for the keys that work (up, down, backspace, delete, tab), it returns a 0 for the keydown and a 1 for the keyup.
For the Enter key, however, it returns 1 for both. I have absolutely no idea why.
Quote:
[4664] 8 : 0
[4664] 8 : 1
[4664] 9 : 0
[4664] 9 : 1
[4664] 46 : 0
[4664] 46 : 1
[4664] 38 : 0
[4664] 38 : 1
[4664] 40 : 0
[4664] 40 : 1
[4664] 13 : 1
[4664] 13 : 1
And here's the really weird thing: when I change the url to "http://www.google.com", the same series of OutputDebug logs shows:
Quote:
[5364] 38 : 0
[5364] 38 : 1
[5364] 40 : 0
[5364] 40 : 1
[5364] 8 : 0
[5364] 8 : 1
[5364] 46 : 0
[5364] 46 : 1
[5364] 9 : 0
[5364] 9 : 1
[5364] 13 : 0
[5364] 13 : 1
Can other people test this and see if you get similar results?