代码如下:CComPtr< IWebBrowser2 > spWB2;
//spWB2.CoCreateInstance( CLSID_InternetExplorer );
spWB2.CoCreateInstance( CLSID_WebBrowser );CComVariant flag;
CComVariant empty;CComBSTR url;
spWB2->Navigate( url, &flag, &empty, &empty, &empty );while( !IsDocumentReady( spWB2.p ) )
Sleep( 500 );CComPtr< IDispatch > spDisp;
spWB2->get_Document( &spDisp );如果使用CLSID_InternetExplorer,可以获得网页,
但如果使用CLSID_WebBrowser,就不行了,有没有方法使用WebBrowser,而不是IE?
//spWB2.CoCreateInstance( CLSID_InternetExplorer );
spWB2.CoCreateInstance( CLSID_WebBrowser );CComVariant flag;
CComVariant empty;CComBSTR url;
spWB2->Navigate( url, &flag, &empty, &empty, &empty );while( !IsDocumentReady( spWB2.p ) )
Sleep( 500 );CComPtr< IDispatch > spDisp;
spWB2->get_Document( &spDisp );如果使用CLSID_InternetExplorer,可以获得网页,
但如果使用CLSID_WebBrowser,就不行了,有没有方法使用WebBrowser,而不是IE?
解决方案 »
- VC+ADO+ACCESS2000
- 请问:如何得到一个链表的长度?
- 编译时出现无法生成预编译头信息pch文件,什么回事?88分是不是比100分动听点?
- 请问:怎样才能获得一个正在运行的进程的句柄呐?
- vc中如何创建文件夹?
- VC 7 项目 LINK 时发生问题
- help me
- 收集讲DLL的网站
- 我用CInternetSession类获得了网页的HTML源文件,但我想把有用的信息还原出来,有处理HTML的类吗?或给出思路,谢谢!
- 如何在onDraw函数中调用InvalidateRect重绘指定区域的图形
- 基于对话框的应用程序如何获取入口参数?谢谢.
- 在COM组件中调用JavaScript函数(非連接點) 的問題
while( !IsDocumentReady( spWB2.p ) )
Sleep( 500 );
-------------
去掉这个。CComPtr< IDispatch > spDisp;
spWB2->get_Document( &spDisp );
---------------------------------
把这段的功能放在OnDocumentComplete事件中。
while( !IsDocumentReady( spWB2.p ) )
Sleep( 500 );总是在执行,等了很久也不会退出。