Common features of Microsoft Web Browser Controls __VC

Source: Internet
Author: User

Http://www.moon-soft.com/doc/33963.htm

Microsoft's Web Browse control

Using the method, select the menu Project-> Add to Project-> components and controls ..., select the registered ActiveX Controls folder in the pop-up dialog box, and then select the Mi in the list Crofost Web browsing controls. or edit a dialog resource, right-click to select the Insert ActiveX control option, or select the control in the list

Main function:

First: Browsing the web

Using the Navigate interface of the control, the prototype is as follows:

void Cwebbrowser2::navigate (Lpctstrurl, variant* Flags, variant* targetframename, variant* postdata, VARIANT* Headers)

As long as the first parameter fills in the full pathname of the HTML file (the relative pathname cannot be used), the rest of the arguments can be null.

This is a very common function, but sometimes flexible use can also receive a lot of unexpected effects, such as:

>> Landscaping Interface: Design a cool Web page with this control display can increase the beauty of the interface

>> Play Music: Play Music in the Web page (mid or WAV), while hiding the control, you can implement the program background music playback. Sample HTML file:

<bgsound src= "Bksound.mid" loop= "-1" >

<body></body>

>> Playback Video: ASF and MPEG formats are supported

>> display pictures: Using a Web browser can simply display GIF, JPEG, BMP and other pictures. Sample HTML file

<body></body>

>> Browse doc documents, PDF files: With the control's navigate interface, you can browse Word documents and PDF files, as long as the first parameter fills in the full pathname of the file, and the following parameters can be null

Second: Print

The control's EXECWB interface enables you to print out what is displayed in the control, and to easily implement print preview and paper size settings.

M_webbrowse the variables that correspond to the control

M_WEBBROWSE.EXECWB (olecmdid_print,olecmdexecopt_promptuser,null,null);//Print

Using the Olecmdexecopt_promptuser parameter, the dialog box pops up before printing, allowing the user to select a printer, page layout, etc.
Using Olecmdexecopt_dontpromptuser will not eject

M_ WEBBROWSE.EXECWB (olecmdid_printpreview,olecmdexecopt_dontpromptuser,null,null); Print Preview

M_ WEBBROWSE.EXECWB (olecmdid_pagesetup,olecmdexecopt_promptuser,null,null); Paper size settings

Third: Intercept submitted data, further can also use DHTML to display the submitted data

These features are implemented primarily by modifying the control's handling of message BeforeNavigate2, as follows:

Onbeforenavigate2explorer1 (//The function calls before the HTML connection)

Lpdispatchpdisp,

variantfar* URL,//ready to browse URL, modify it to achieve steering

Variantfar* Flags,

Variantfar* Targetframename,

variantfar* PostData,

Variantfar* Headers,

boolfar* Cancel)//true: Stop FALSE: Continue

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.