paulwarr wrote:
If someone could translate this TranslateAccelerator code, then our conquest of this blasted WebBrowser control would be nearly complete!
I was thinking about lower-level one, however, I think this one will also work.
Code:
Gui, +Resize +LastFound
Gui, Show, w800 h600 Center, WebBrowser
hGui := WinExist()
OnMessage(WM_KEYDOWN:=0x0100, "WM_KEYDOWN")
COM_AtlAxWinInit()
pweb := COM_AtlAxCreateControl(hGui, "Shell.Explorer")
COM_Invoke(pweb, "Navigate", "http://www.google.com/")
Return
GuiClose:
Gui, Destroy
COM_Release(pweb)
COM_AtlAxWinTerm()
ExitApp
WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
; Critical 20
If (wParam = 0x09 || wParam = 0x0D)
{
WinGetClass, Class, ahk_id %hWnd%
If (Class == "Internet Explorer_Server")
{
Global pweb
pipa := COM_QueryInterface(pweb, "{00000117-0000-0000-C000-000000000046}")
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)
DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
Return 0
}
}
}
I used
Global here for simplicity, which I think can be easily overcome.