精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>C/C++>>WINDOWS界面设计>>HTML界面>>Sample:Start Find,View Source& Options

主题:Sample:Start Find,View Source& Options
发信人: jiangsheng()
整理人: wenbobo(2002-12-27 16:00:21), 站内信件
#include <initguid.h>
DEFINE_GUID(CGID_IWebBrowser,0xED016940L,0xBD5B,0x11cf,0xBA, 0x4E,0x00
,0xC0,0x4F,0xD7,0x08,0x16);

DWORD nCmdID = 1; //1 : FIND, 2: VIEWSOURCE, 3 : OPTIONS

LPDISPATCH lpDispatch = NULL;
LPOLECOMMANDTARGET lpOleCommandTarget = NULL;

lpDispatch = m_htmlview.GetDocument();
ASSERT(lpDispatch);

// Get an IDispatch pointer for the IOleCommandTarget interface.
lpDispatch->QueryInterface(IID_IOleCommandTarget,
(void**)&lpOleCommandTarget);
ASSERT(lpOleCommandTarget);

lpDispatch->Release();

// Invoke the given command id for the WebBrowser control
lpOleCommandTarget->Exec(&CGID_IWebBrowser, nCmdID, 0,
NULL, NULL);

// Release the command target
lpOleCommandTarget->Release();
 

"m_htmlview" is the member variable for the CWebBrowser2 control. 

--
HE WHO CONTROLS THE PAST, COMMANDS THE FUTURE.
HE WHO CONTROLS THE FUTURE CONQUERS THE PAST.

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.44.196]

[关闭][返回]