In the VC ++ program, HTML file loads are displayed in the form of a text box, with the advantage of dynamic loading of com dll)

Source: Internet
Author: User
ArticleDirectory
    • Zhou daibing

Zhou daibing

---- After installing IE 4, you can use the format of the text box to display the HTML file in the Process Order, such as pop-up text AIDS written in HTML, etc. For example, the browser is connected directly, but it is different from the browser style.

---- Its implementation is as follows:

// In the header file or. the beginning of the CPP file contains the file urlmon. h, define the function // # include "urlmon. H "typedef hresult stdapicalltype showhtmldialogfn (hwnd hwndparent, imoniker * PMK, variant * pvarargin, tchar * pchoptions, variant * pvargout); // The function display dialog box, true is returned successfully. falsebool showhtml () {hinstance hinstmshtml = loadlibrary (text ("mshtml. DLL "); // load the dynamic Connection Library wchar URL [] = l" http: // www.ccw.com.cn "; // This address name can be directly replaced by an HTML file name if (hinstmshtml) // dynamic connection library loaded {s * 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 to display the HTML file pfnshowhtmldialog (m_hwnd, moniker, null) on the URL. If (moniker! = NULL) moniker-> release (); // If the display is successful, true return true;} else // getprocessaddress fails to return false; freelibrary (hinstmshtml );} else // failed to load dynamic Connection Library return false ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.