ASP. NET Method for calling the printer control IEWebBrowser

Source: Internet
Author: User

I have sorted out the execWB METHOD OF THE IEWebBrowser component and hope to help you.
1. <object id = "WebBrowser" width = 0 height = 0 classid = "CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2"> </object>
2. Call the method.
WebBrowser. ExecWB n1_id, nCmdExecOpt, [pvaIn], [pvaOut]
3. parameter description.
(A). n1_id
OLECMDID_OPEN = 1,
OLECMDID_NEW = 2,
OLECMDID_SAVE = 3,
OLECMDID_SAVEAS = 4,
OLECMDID_SAVECOPYAS = 5,
OLECMDID_PRINT = 6,
OLECMDID_PRINTPREVIEW = 7,
OLECMDID_PAGESETUP = 8,
OLECMDID_SPELL = 9,
OLECMDID_PROPERTIES = 10,
OLECMDID_CUT = 11,
OLECMDID_COPY = 12,
OLECMDID_PASTE = 13,
OLECMDID_PASTESPECIAL = 14,
OLECMDID_UNDO = 15,
OLECMDID_REDO = 16,
OLECMDID_SELECTALL = 17,
OLECMDID_CLEARSELECTION = 18,
OLECMDID_ZOOM = 19,
OLECMDID_GETZOOMRANGE = 20
OLECMDID_UPDATECOMMANDS = 21
OLECMDID_REFRESH = 22
OLECMDID_STOP = 23
OLECMDID_HIDETOOLBARS = 24
OLECMDID_SETPROGRESSMAX = 25
OLECMDID_SETPROGRESSPOS = 26
OLECMDID_SETPROGRESSTEXT = 27
OLECMDID_SETTITLE = 28
OLECMDID_SETDOWNLOADSTATE = 29
OLECMDID_STOPDOWNLOAD = 30
The above keywords can all be found in the menu of the browser. You can see it at a glance ﹗
(B). nCmdExecOpt
OLECMDEXECOPT_DODEFAULT = 0,
OLECMDEXECOPT_PROMPTUSER = 1,
LECMDEXECOPT_DONTPROMPTUSER = 2,
OLECMDEXECOPT_SHOWHELP = 3
For this parameter, select 1.

This is an example of calling the "Save as" function of IE ﹕

<Object id = "WebBrowser" width = 0 height = 0 classid = "CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2"> </object>
<A href = "javascript: WebBrowser. ExecWB (4, 1);"> Save-storage </A>

OBJECT classid = "CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2" height = 0 id = WebBrowser width = 0> </OBJECT>
<Table> <tr> <td>
<Input name = Button onClick = document. all. WebBrowser. ExecWB (1,1) type = button value = open>
</Td> </tr>
<Tr> <td> <input name = Button onClick = document. all. WebBrowser. ExecWB (2, 1)
<Tr> <td> <input name = Button onClick = document. all. WebBrowser. ExecWB (4, 1) type = button value = Save As> </td> </tr>
<Tr> <td> <input name = Button onClick = document. all. WebBrowser. ExecWB (10, 1) type = button value = property> </td> </tr>
<Tr> <td> <input name = Button onClick = document. all. WebBrowser. ExecWB (6, 1) type = button value = print> </td> </tr>
<Tr> <td> <input name = Button onClick = document. all. webBrowser. execWB (6, 6) type = button value = print> no printer window is displayed </td> </tr>
<Tr> <td> <input name = Button onClick = document. all. WebBrowser. ExecWB (7,1) type = button value = print preview> </td> </tr>
<Tr> <td> <input name = Button onClick = document. all. WebBrowser. ExecWB (8, 1) type = button value = page setting> </td> </tr>
<Tr> <td> <input name = Button onClick = document. all. WebBrowser. ExecWB (10, 1) type = button value = view page attributes> </td> </tr>
<Tr> <td> <input name = Button onClick = document. all. WebBrowser. ExecWB (15,1) type = button value = undo> </td> </tr>
<Tr> <td> <input name = Button onClick = document. all. WebBrowser. ExecWB (17,1) type = button value = select all> </td> </tr>
<Tr> <td> <input name = Button onClick = document. all. WebBrowser. ExecWB (22, 1) type = button value = Refresh> </td> </tr>
<Tr> <td> <input name = Button onClick = document. all. webBrowser. execWB (45, 1) type = button value = close the form without prompt> </td> </tr>
<Tr> <td> <input type = button value = refresh name = refresh onclick = "window. location. reload ()">
</Td> </tr>

IEWebBrowser
1. Open

<Input name = "Button" onClick = "document. all. WebBrowser. ExecWB (1, 1 )"
Type = "button" value = "open">
<OBJECT classid = "CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2" height = "0"
Id = "WebBrowser" width = "0"> </OBJECT>

2. Save

<Input name = "Button" onClick = "document. all. WebBrowser. ExecWB (4,1 )"
Type = "button" value = "Save as">
<OBJECT classid = "CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2" height = "0"
Id = "WebBrowser" width = "0"> </OBJECT>

3. Attributes

<Input name = "Button" onClick = "document. all. WebBrowser. ExecWB (10, 1 )"
Type = "button" value = "property">
<OBJECT classid = "CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2" height = "0"
Id = "WebBrowser" width = "0"> </OBJECT>

4. Print

<Input name = "Button" onClick = "document. all. WebBrowser. ExecWB (6, 1 )"
Type = "button" value = "print">
<OBJECT classid = "CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2" height = "0"
Id = "WebBrowser" width = "0"> </OBJECT>

5. Page settings

<Input name = "Button" onClick = "document. all. WebBrowser. ExecWB (8, 1 )"
Type = "button" value = "page settings">
<OBJECT classid = "CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2" height = "0"
Id = "WebBrowser" width = "0"> </OBJECT>

6. Refresh

<Input type = "button" value = "refresh" name = "refresh" onclick = "window. location. reload ()">

7. Import to favorites

<Input type = "button" name = "Button" value = "Import favorites"
OnClick = "window. external. ImportExportFavorites (true,);">

8. Export to favorites

<Input type = "button" name = "Button" value = "Export favorites"
OnClick = "window. external. ImportExportFavorites (false,);">

9. Add to favorites

<Input name = "Button" onclick = "window. external. AddFavorite (location. href, document. title )"
Type = "button" value = "add to Favorites">

10. Sort favorites

<Input name = "Submit" onclick = "window. external. ShowBrowserUI (OrganizeFavorites, null )"
Type = "button" value = "favorites">

11. View source files

<Input name = "Button" onclick = window. location = "view-source:" + window. location. href
Type = button "value =" View Source File ">

12. Language settings

<Input name = "Button" onclick = "window. external. ShowBrowserUI (LanguageDialog, null )"
Type = "button" value = "language Settings">

13. Forward

<Input name = "Submit" onclick = "history. go (1);" type = "submit" value = "Forward">

14. Backward

<Input name = "Submit" onclick = "history. go (-1);" type = "submit" value = "">

Or

<Input name = "Submit" onclick = "history. back ();" type = "submit" value = "">

ExecWB method of the IEWebBrowser component:

1. <object id = "WebBrowser" width = "0" height = "0"
Classid = "CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2"> </object>

2. Call Method

WebBrowser. ExecWB (n1_id, nCmdExecOpt)

3. parameter description

NCmdID: (all the keywords can be found in the menu of the browser)
OLECMDID_OPEN = 1 // open
OLECMDID_NEW = 2 // new
OLECMDID_SAVE = 3 // save
OLECMDID_SAVEAS = 4 // save
OLECMDID_SAVECOPYAS = 5 //
OLECMDID_PRINT = 6 // print
OLECMDID_PRINTPREVIEW = 7 // print preview
OLECMDID_PAGESETUP = 8 // page settings
OLECMDID_SPELL = 9 //
OLECMDID_PROPERTIES = 10 // attribute
OLECMDID_CUT = 11 // cut
OLECMDID_COPY = 12 // copy
OLECMDID_PASTE = 13 // Paste
OLECMDID_PASTESPECIAL = 14 //
OLECMDID_UNDO = 15 //
OLECMDID_REDO = 16 //
OLECMDID_SELECTALL = 17 // select all
OLECMDID_CLEARSELECTION = 18 //
OLECMDID_ZOOM = 19 //
OLECMDID_GETZOOMRANGE = 20 //
OLECMDID_UPDATECOMMANDS = 21 //
OLECMDID_REFRESH = 22 // refresh
OLECMDID_STOP = 23 // stop
OLECMDID_HIDETOOLBARS = 24 // hide the toolbar
OLECMDID_SETPROGRESSMAX = 25 //
OLECMDID_SETPROGRESSPOS = 26 //
OLECMDID_SETPROGRESSTEXT = 27 //
OLECMDID_SETTITLE = 28 //
OLECMDID_SETDOWNLOADSTATE = 29 //
OLECMDID_STOPDOWNLOAD = 30 //

NCmdExecOpt: (select 1 for this parameter)

OLECMDEXECOPT_DODEFAULT = 0 //
OLECMDEXECOPT_PROMPTUSER = 1 //
LECMDEXECOPT_DONTPROMPTUSER = 2 //
OLECMDEXECOPT_SHOWHELP = 3

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.