Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML Viewer as ActiveX Control

Status
Not open for further replies.

dmsolomon

Programmer
Jul 24, 2000
1
US
Greetings,<br><br>I'm a bit new to the ActiveX world and am searching for something that I'm having trouble finding.&nbsp;&nbsp;<br><br>What I need is a very simple HTML viewer that will need to view HTML only documents (ie no JavaScript, no VBScript, etc).&nbsp;&nbsp;<br><br>Basically I need to insert a control on a VB form that, when clicked, displays the appropriate web page. <br><br>I've played a bit with the Microsoft PopUp viewer, but it's not very flexible and I would like print capabilities if I can find it.&nbsp;&nbsp;<br><br>I believe that the MS PopUp viewer uses the IE engine and would like to harness that if I could.&nbsp;&nbsp;Any thoughts or tips would be greatly appreciated.<br><br>Thanks,<br><br>David<br><A HREF="mailto:david.solomon@apexit.com">david.solomon@apexit.com</A><br><br>
 
Dear David,<br><br>// Generated .IDL file (by the OLE/COM Object Viewer)<br>// <br>// typelib filename: SHDOCVW.DLL<br><br>[<br>&nbsp;&nbsp;uuid(EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B),<br>&nbsp;&nbsp;version(1.1),<br>&nbsp;&nbsp;helpstring(&quot;Microsoft Internet Controls&quot;)<br>]<br>library SHDocVw<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;// TLib :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}<br>&nbsp;&nbsp;&nbsp;&nbsp;importlib(&quot;Stdole2.tlb&quot;);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;// Forward declare all types defined in this typelib<br>&nbsp;&nbsp;&nbsp;&nbsp;interface IWebBrowser;<br>&nbsp;&nbsp;&nbsp;&nbsp;dispinterface DWebBrowserEvents;<br>&nbsp;&nbsp;&nbsp;&nbsp;interface IWebBrowserApp;<br>&nbsp;&nbsp;&nbsp;&nbsp;interface IWebBrowser2;<br>&nbsp;&nbsp;&nbsp;&nbsp;dispinterface DWebBrowserEvents2;<br>&nbsp;&nbsp;&nbsp;&nbsp;dispinterface DShellWindowsEvents;<br>&nbsp;&nbsp;&nbsp;&nbsp;interface IShellWindows;<br>&nbsp;&nbsp;&nbsp;&nbsp;interface IShellUIHelper;<br>&nbsp;&nbsp;&nbsp;&nbsp;dispinterface _ShellFavoritesNameSpaceEvents;<br>&nbsp;&nbsp;&nbsp;&nbsp;interface IShellFavoritesNameSpace;<br>&nbsp;&nbsp;&nbsp;&nbsp;interface IScriptErrorList;<br>&nbsp;&nbsp;&nbsp;&nbsp;interface ISearch;<br>&nbsp;&nbsp;&nbsp;&nbsp;interface ISearches;<br>&nbsp;&nbsp;&nbsp;&nbsp;interface ISearchAssistantOC;<br>&nbsp;&nbsp;&nbsp;&nbsp;interface ISearchAssistantOC2;<br>&nbsp;&nbsp;&nbsp;&nbsp;dispinterface _SearchAssistantEvents;<br><br><br>Help for all these interfaces can be found on MSDN. I believe IWebBrowser2 has support for printing.<br><br>Good luck<br>-pete
 
Here is a code snippet that handles printing using the IE Web browser control. If you embed a web browser ActiveX control in your dialog resource you can attach the control to a variable (in this case named m_browser) using the classwizard then follow the snippet below to print.

// Printing an HTML Page using WebBrowser ActiveX Control
// m_browser is the class for the Web Browser Control

LPOLECOMMANDTARGET lpTarget = NULL;
LPDISPATCH lpDisp = m_browser.GetDocument();
if (lpDisp != NULL)
{
if (SUCCEEDED(lpDisp->QueryInterface(IID_IOleCommandTarget, (LPVOID*) &lpTarget)))
{
lpTarget->Exec(NULL, OLECMDID_PRINT, 0, NULL, NULL);
lpTarget->Release();
}
lpDisp->Release();
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top