cppwebBrowser中的自带的那个查看源文件的命令如何调用实现
想实现查看源文件的功能....
如何将那个命令调用出来
[解决办法]
接分,
IOleCommandTarget *pCmd=NULL;
CppWebBrowser-> Document-> QueryInterface(IID_IOleCommandTarget,(void **)(&pCmd));
if(pCmd)
{
pCmd-> Exec(&CGID_MSHTML,IDM_VIEWSOURCE,::OLECMDEXECOPT_DODEFAULT,NULL,NULL);
pCmd-> Release();
}
[解决办法]
需要QueryInterface
然后Exec IDM_VIEWSOURCE
[解决办法]
有个简单的方法,并且对其他进程的WebBrowser也有用
void __fastcall TForm1::FormCreate(TObject *Sender)
{
CppWebBrowser1-> Navigate(WideString( "http://blog.sina.com.cn/zswang "));
}
//---------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int IDM_VIEWSOURCE = 2139;
HWND vHandle = CppWebBrowser1-> Handle;
vHandle = FindWindowEx(vHandle, NULL, "Shell DocObject View ", NULL);
vHandle = FindWindowEx(vHandle, NULL, "Internet Explorer_Server ", NULL);
SendMessage(vHandle, WM_COMMAND, IDM_VIEWSOURCE, (long)Handle);
}
//---------------------------------------
谁用谁知道!
[解决办法]
参见http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/reference.asp
需要下载
http://www.microsoft.com/downloads/details.aspx?FamilyID=c2b1e300-f358-4523-b479-f53d234cdccf&DisplayLang=en