Earlier, because the project needs to do an automatic landing site ActiveX Plug-ins. The main function is to start an IE instance through this plugin or use the browser where the plugin resides,
Play a website (that is, through navigate navigation), through the IHTMLDocument2 interface to find the relevant elements, and fill in the corresponding value, the last simulation click the Landing button, complete the landing. This
The method is simple and theoretically belongs to simulated artificial landing, and the limitation is relatively small. But it has a disadvantage, is to open the landing page, fill in the value of the process, not directly into the landing
The post page looks more natural.
View Msdn,iwebbrowser2::navigate declaration again:
HRESULT Navigate (BSTR URL,
variant *flags,
variant *targetframename,
variant *postdata,< c4/> VARIANT *headers
);
The fourth parameter is PostData, that can be attached with postdata data directly into it? Look down
PostData:
[In] Pointer to data to send with the HTTP POST transaction. For example, the POST transaction be used to send data gathered
by an HTML form. If This parameter does is not specify any post data, iwebbrowser2::navigate issues a HTTP get transaction.
This means that specifying the PostData parameter is the same as submitting it through an HTML form. Of course it works.
The type of this parameter is VARIANT,MSDN:
The post data specified by PostData is passed as a SAFEARRAY data Type structure. The VARIANT should is of type vt_array and point
To a SAFEARRAY Data Type. The SAFEARRAY Data type should is of element Type vt_ui1, dimension one, and have an element count equal
To the number of bytes of post data.