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