Manage Internet Explorer to enter username / password

I was looking for an attempt to get my C ++ application to do the following:

  • Open Internet Explorer
  • Open the webpage.
  • Enter your username and password in certain forms on the web page.
  • Click the submit button on the web page to open a new page

From my search on the Internet, it seems that using COM can make this possible, although maybe I'm wrong. I am doing my best to learn COM at the moment, but some help would be great. I want to do this without using MFC.

I noticed this question, which I’m looking for, but it’s hard for me to understand the proposed solutions. For example, I do not have an option IWebBrowser2in my toolbar.

EDIT:

To make my question clearer, I completed this task in the C # version by simply running an encoded user interface test, but this will not work with C ++. I am looking to open IE (not in the application itself), find the username and password forms, pass them a string, then find the submit button on the page and click it.

+3
source share
4 answers

This is very possible from C ++. You will need to dive into winapi to perform some keyboard operations as well as window processing.

I will not go into all the code, but you should do something like the following:

  • Start by saying that (if you give it a command line command with a web page, it will open this page).
  • , ie ( api, HANDLE )
  • SendInput, Alt + D ( url, firefox )
  • SendInput javascript injection, DOM
  • ( , , ) JS-.
+1

, , - , ( , DHTML Internet Explorer COM).

, MFC, . , ATL, .

MFC, CDHtmlDialog COM- .

MFC, HTML , CDHTMLView, : http://www.codeproject.com/Articles/1783/Integrating-DHTML-into-MFC-Views

, , DHTML IWebBrowser2.

0

WebDriver, , . . (Http://code.google.com/p/selenium/wiki/InternetExplorerDriverInternals) InternetExplorerDriver. , , , , , , , .

0

, , .

There are many APIs for embedding browser views in your program. For example, Qt offers this.

Then you can simply execute your HTTP POST request yourself and display the response you will receive in your browser.

This is a much cleaner solution.

Tip. Do not use Internet Explorer.

-1
source

All Articles