I've executed your script/sample and based on the above links, set within the code I've expected to get/see one of those pages loaded within the Gui/Control. But I might be wrong.
Sorry for the inconvenience. Yes, I only tested it on my XPSP2. And machines I can access around me are all XPSP2 too.
I rewrote it replacing direct references with appropriate indrections. Please follow the instructions in MsgBox after executing.
Thx for your effort. Much appreciated.
Thanks.
I'm afraid this may be my last post for a while, I've been detracted too much from my current project, so I have to concentrate on it for now.
Gui, Show, w800 h600 Center, WebBrowser
hWnd := WinExist( "WebBrowser" )
sWinName := "Shell.Explorer" ; ProgID of WebBrowser control
VarSetCapacity(IID_IDispatch, 16)
;Encode 128bit IID_IDispatch
EncodeInteger(&IID_IDispatch , 0x00020400)
EncodeInteger(&IID_IDispatch + 4, 0)
EncodeInteger(&IID_IDispatch + 8, 0xC0)
EncodeInteger(&IID_IDispatch +12, 0x46 << 24)
hModule := DllCall("LoadLibrary", "str", "atl.dll")
DllCall("atl\AtlAxWinInit")
hCtrl := DllCall("CreateWindowEx"
, "Uint", 0x200 ; WS_EX_CLIENTEDGE
, "str", "AtlAxWin" ; ClassName
, "Uint", &sWinName ; WindowName
, "Uint", 0x10000000 | 0x40000000 ; WS_VISIBLE | WS_CHILD
, "int", 0 ; Left
, "int", 0 ; Top
, "int", 800 ; Width
, "int", 600 ; Height
, "Uint", hWnd
, "Uint", 0
, "Uint", 0
, "Uint", 0)
; Obtain IUnknown Interface
DllCall("atl\AtlAxGetControl", "Uint", hCtrl, "UintP", ppunk)
; Obtain IDispatch Interface
DllCall(DecodeInteger(DecodeInteger(ppunk) + 4*0) ; QueryInterface
, "Uint", ppunk
, "Uint", &IID_IDispatch
, "UintP", ppwb)
DllCall(DecodeInteger(DecodeInteger(ppunk) + 4*2) ; Release
, "Uint", ppunk)
If !ppwb
{
MsgBox, We're Failed. Now Exit the app.
ExitApp
}
Else
MsgBox, We're ready for the test after pressing OK!
sUrl := "http://www.autohotkey.com/"
VarSetCapacity(wUrl, StrLen(sUrl) * 2 + 2)
Unicode(sUrl, wUrl)
sUrl1 := "http://www.autohotkey.com/forum/"
VarSetCapacity(wUrl1, StrLen(sUrl1) * 2 + 2)
Unicode(sUrl1, wUrl1)
DllCall(DecodeInteger(DecodeInteger(ppwb) + 4*11) ; Navigate
, "Uint", ppwb
, "Uint", &wUrl
, "Uint", 0
, "Uint", 0
, "Uint", 0
, "Uint", 0)
MsgBox, Wait for "LOADING" AHK site completed, then press OK
DllCall(DecodeInteger(DecodeInteger(ppwb) + 4*11) ; Navigate
, "Uint", ppwb
, "Uint", &wUrl1
, "Uint", 0
, "Uint", 0
, "Uint", 0
, "Uint", 0)
MsgBox, Wait for "LOADING" AHK Forum completed, then press OK
DllCall(DecodeInteger(DecodeInteger(ppwb) + 4*7) ; GoBack
, "Uint", ppwb)
MsgBox, Wait until "GO BACK" done, then press OK
DllCall(DecodeInteger(DecodeInteger(ppwb) + 4*8) ; GoForward
, "Uint", ppwb)
MsgBox, Wait until "GO FORWARD" done, then all test DONE!
DllCall(DecodeInteger(DecodeInteger(ppwb) + 4*2) ; Release
, "Uint", ppwb)
DllCall("FreeLibary", "Uint", hModule)
Unicode(ByRef sString, ByRef wString)
{
DllCall("MultiByteToWideChar"
, "Uint", 0
, "Uint", 0
, "Uint", &sString
, "int", -1
, "Uint", &wString
, "int", StrLen(sString) + 1)
}
DecodeInteger(ref)
{
DllCall("ntdll\RtlMoveMemory", "UintP", val, "Uint", ref, "Uint", 4)
Return val
}
EncodeInteger(ref, val)
{
DllCall("ntdll\RtlFillMemoryUlong", "Uint", ref, "Uint", 4, "Uint", val)
}