C # operating with COM components ie browser (i): Open browser jump to the specified website

Source: Internet
Author: User

Introduction to the Internet Explorer object model

1. Properties

Property Type Describe

Application

Object

Returns a reference to an Internet Explorer object.

Busy

Boolean

Returns a Boolean value that indicates whether Internet Explorer is busy downloading data or performing some other activity. True indicates that busy false instructions are not busy.

Container

Object

Returns a reference, if any, to the container/parent of Internet Explorer.

Document

Object

Returns a reference to the active document, if any.

FullName

String

Returns the full path name of an Internet Explorer executable file. (for example, C: \ program FILES \ Plus! \ MICROSOFT INTERNET \ IEXPLORE. EXE)

Fullscreen

Boolean

Returns or sets the Internet Explorer window mode. True indicates that the window is maximized, the status bar, the toolbar , the menu bar, and the title bar are hidden.

Height, Width

Long

Returns or sets the dimensions, in pixels, of the Internet Explorer window.

HWND

Long

Returns the window handle MsgBox of the current Internet Explorer window.

Left, Top

Long

Returns or sets the location, in pixels, of the Internet Explorer window relative to the screen/container.

LocationName

String

Returns the name of the file currently being viewed. (Example: Microsoft Corporation)

Locationurl

String

Returns the full URL of the file currently being viewed. (Example: http://www.microsoft.com/)

MenuBar

Boolean

Returns or sets the display if the menu bar is displayed. True to indicate that the menu bar is visible; False to indicate that it is hidden.

Name

String

Returns the name of an Internet Explorer application. (Example: Microsoft Internet Explorer)

Parent

Object

Returns a reference to the container/parent of Internet Explorer.

Path

String

Returns the full path name of an Internet Explorer application. (for example, C: \ program FILES \ Plus! \ MICROSOFT INTERNET \)

StatusBar

Boolean

Returns or sets the display of the status bar. True indicates that the status bar is visible; False to indicate that it is hidden.

StatusText

String

Returns or sets the text of the status bar.

ToolBar

Long

Returns or sets which toolbar is displayed. For example, 0 means that there is no toolbar; 1 indicates the default toolbar.

Toplevelcontainer

Boolean

Returns a Boolean value that indicates whether the current object is a top-level container. True indicates that the object is a top-level container; False means No.

Type

String

Returns the document type in Internet Explorer.

Visible

Boolean

Returns or sets the display of Internet Explorer. True indicates that Internet Explorer is visible; False to indicate that it is hidden.

2. Methods

Method Describe Usage

Clienttowindow (pcx, pcy)

Converts the client size to the window size.

GetProperty (szproperty)

Returns the value of the specified property. Szproperty is defined as a string.

GoBack, GoForward

Used to navigate Internet Explorer based on the values in the History list.

browser. GoBack

GoHome, Gosearch

Used to browse Internet Explorer.

Browser. GoHome

Navigate (URL [, Flags] [, targetframename] [, postdata] [, Headers])

Jumps to the specified URL. is one of the following constants or values: Navopeninnewwindow = 1 Navnohistory = 2 Navnoreadfromcache = 4 Navnowritetocache = 8 targetframename is a A string that specifies the name of the frame that will display the result. PostData is the data sent using an HTTP POST transaction. The header is the value that specifies the HTTP header to send.

Flags browser. Navigate ("http://www.vb-bootcamp.com")

PutProperty (szproperty, vtvalue)

Sets the property to the specified vtvalue) value. Szproperty is defined as a string and is defined as a variant.

Quit

Exit the Internet Explorer application and close the open document.

Browser. Quit

Refresh

Refreshes the current document.


Browser
. Refresh

REFRESH2 [level]

Refreshes the current document. The level is one of the following constants or values: Refresh_normal = 0 refresh_ifexpired = 1 refresh_continue = 2 refresh_completely = 3

browser. REFRESH2 (0) browser. REFRESH2 (Refresh_normal)

Stop

Stops loading the current document.


Browser.
Stop

Here's the start: 1. Add a reference to the COM component first
    • Add a reference to Microsoft Internet controls;
    • Add a reference to the Microsoft HTML Object Library; (actually mshtml)
2. Create InternetExplorer object, open Browser

The following code snippet jumps to the blog Park login page:

Shdocvw.internetexplorer Obrowser =NewShdocvw.internetexplorer (); ObjectObjflags =1; ObjectObjtargetframename ="_self"; ObjectObjpostdata =""; ObjectObjheaders =""; Obrowser.visible=true; Obrowser.navigate ("Https://passport.cnblogs.com/user/signin",refObjflags,refObjtargetframename,refObjpostdata,refObjheaders);

The first chapter opens the browser, jumps the website The section introduces here, the next chapter introduces uses the Ihtmldocument2,ihtmldocument3 to log in and so on some operation.

C # operating with COM components ie browser (i): Open browser jump to the specified website

Related Article

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.