VC interpretation of the HTML file in the form of a dialog box
Zhou Daibing - After IE 4 is installed, you can display HTML files in the form of the dialog box. If you pop up a help file written by HTML, you can use the browser directly, but it is different from the browser style. . ---- It is implemented as follows: // At the beginning of the header file or .cpp file
Contains file urlmon.h, define functions
/
#include "urlmon.h"
Typedef HRESULT stdapicaltype showhtmldialogfn
(HWND HWNDPARENT, IMONIKER
* PMK, Variant * PVARARGIN, TCHAR * PCHOPTIONS,
VARIANT * PVARGOUT;
//
// Function Displays the dialog, successfully returns true, failed to return false
BOOL Showhtml ()
{
Hinstance hinstmshtml = loadinglibrary
(Text ("mshtml.dll")); // Loading a dynamic connection
Contact
Wchar URL [] = L "http://www.ccw.com.cn";
// This address name can be replaced directly with the HTML file name
IF (hinstmshtml) // loaded dynamic connection library success
{
Showhtmldialogfn * pfnshowhtmldialog;
PfnShowhtmldialog = (Showhtmldialogfn *)
GetProcaddress (Hinstmshtml,
Text ("Showhtmldialog"));
IF (PfnShowhtmldialog)
{
IMoniker * Moniker = NULL;
//
IF (Failed (CreateURLMoniker (NULL,
(LPWSTR) URL, & MONIKER))))))))
{
Freelibrary (HinstMSHTML);
Return False;
}
// Call the showhtmldialog function Displays the HTML file on the URL
PfnShowhtmldialog (M_HWND, Moniker, Null, Null, NULL);
IF (Moniker! = NULL)
Moniker-> Release ();
// Show success, return to TRUE
Return True;
}
ELSE // getProcessAddress failed
Return False;
Freelibrary (HinstMSHTML);
}
ELSE // loaded dynamic connection library failed
Return False;
} China Computer World Publishing Service Company Copyright