#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();