I try to connect to connection point
Source code here
Sorry for my English :)
invoke CoInitialize, 0
invoke CoCreateInstance, addr CLSID_InternetExplorer, NULL,
CLSCTX_SERVER,
addr IID_IWebBrowser2, addr ppv
coinvoke ppv, IWebBrowser2, Visible_put, VARIANT_TRUE
coinvoke ppv, IWebBrowser2, Offline_put, VARIANT_FALSE
coinvoke ppv, IWebBrowser2, Navigate2, addr v1, addr v2, addr v2, addr v2, addr v2
coinvoke ppv, IWebBrowser2, StatusText_get, addr statstr
coinvoke ppv, IWebBrowser2, Document_get, addr pDisp
[b]; QueryInterface return FAILED
coinvoke pDisp, IDispatch, QueryInterface, addr IID_IHTMLDocument2, addr pHtmlDoc
[/b]
coinvoke ppv, IWebBrowser2, Quit
invoke SysFreeString, urlstr
coinvoke ppv, IWebBrowser2, Release
invoke CoUninitialize
Source code here
Sorry for my English :)
this looks fine, and works for me. I'm not familar with that coinvoke macro, you can get the IHTMLDocument2 interface directly from the IDispatch object returned by get_Document:
if this does fail, your document may be not ok, or some special document, like XML or file protocol or something...
lea eax, hcomDoc2
push eax
push offset idIHTMLDocument2
push hcomIDispDoc
mov eax, hcomIDispDoc
call [eax + idisp_QueryInterface]
if this does fail, your document may be not ok, or some special document, like XML or file protocol or something...
Are you tryint to start IExplorer. Try the ComTool. This will start IExplorer.
.386
.model flat, stdcall ;32 bit memory model
option casemap :none ;case sensitive
include windows.inc
include kernel32.inc
include user32.inc
include Comctl32.inc
include shell32.inc
include ole32.inc
include oleaut32.inc
includelib kernel32.lib
includelib user32.lib
includelib Comctl32.lib
includelib shell32.lib
includelib ole32.lib
includelib oleaut32.lib
DlgProc PROTO :HWND,:UINT,:WPARAM,:LPARAM
IDispRelease PROTO :DWORD
.const
;IE-com.dlg
IDD_DIALOG1 equ 101
IDC_BTN1 equ 1001
IDC_BTN2 equ 1002
.data
szIExplorer db "InternetExplorer.Application",0
IID_IWebBrowserApp GUID {00002DF05h,00000h,00000h,{0C0h,000h,000h,000h,000h,000h,000h,046h}}
.data?
hInstance dd ?
pIWebBrowserApp dd ?
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke InitCommonControls
invoke CoInitializeEx,0,0 ;COINIT_MULTITHREADED
invoke DialogBoxParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
invoke ExitProcess,0
DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL lpWideCharStr[128]:byte
LOCAL clsidApp:GUID
mov eax,uMsg
.if eax==WM_INITDIALOG
.elseif eax==WM_COMMAND
mov edx,wParam
movzx eax,dx
shr edx,16
.if edx==BN_CLICKED
.if eax==IDC_BTN1
invoke MultiByteToWideChar,CP_ACP,0,addr szIExplorer,-1,addr lpWideCharStr,sizeof lpWideCharStr
invoke CLSIDFromProgID,addr lpWideCharStr,addr clsidApp
invoke CoCreateInstance,addr clsidApp,0,CLSCTX_SERVER,addr IID_IWebBrowserApp,addr pIWebBrowserApp
.if eax==S_OK
mov eax,pIWebBrowserApp
mov edx,[eax]
push VARIANT_TRUE
push pIWebBrowserApp
;call IWebBrowserApp.put_Visible
call dword ptr [edx+41*4]
.endif
.elseif eax==IDC_BTN2
mov eax,pIWebBrowserApp
mov edx,[eax]
push pIWebBrowserApp
;call IWebBrowserApp._Quit
call dword ptr [edx+32*4]
.if eax==S_OK
invoke IDispRelease,addr pIWebBrowserApp
.endif
.endif
.endif
.elseif eax==WM_CLOSE
invoke EndDialog,hWin,0
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgProc endp
IDispRelease proc uses edi esi edx pClass:dword
mov eax,pClass
mov eax,dword ptr [eax]
mov edx,dword ptr [eax]
push eax ;pClass
;call pClass._Release
call dword ptr [edx+2*4]
.if eax==0
mov eax,pClass
mov dword ptr[eax],0
.endif
ret
IDispRelease endp
end start