Get the contents of the password and text input box in the page

zhaozj2021-02-16  47

Introducing the password input box in the web page and generally different, he has no handle, but you can get it through the IHTMLINPUTTEXTELEMENT interface!

This article teaches you how to get the contents of the box in the web page. How do you want to get a password in a web page, just change the IF (LSTRCMPI (")) == 0) to IF (LSTRCMPI (")) == 0) If you add a real-time monitoring, you have become a password to steal the program! Main ideas: Get the IE's IHTMLINPUTTEXTELEMENT interface so you can get the contents of the input box (including the text and password input box) in the web page. WARNING: This code is only used as the use of learning and programming tests. It is strictly forbidden to use it for business or illegal purposes. Otherwise, all consequences have nothing to do! If you want to reprint, please contact the author! CopyRight (c) 2002. All Rights Reserved.

VARIANT id, index; CComPtr spDispatch; CComQIPtr pDoc2; CComQIPtr pElement; CComPtr pElementCol; CComPtr pFormElement; CComPtr pInputElement; // first acquires IWebBrowser2 Interface CoInitialize (NULL); // initialize sentence must SHDocVw :: IWebBrowser2Ptr spBrowser (spDisp); if (m_spSHWinds == NULL) {if (! m_spSHWinds.CreateInstance (__ uuidof (SHDocVw :: ShellWindows)) = S_OK) {MessageBox ("Failed"); counitialize ();}}} (m_spshwinds) {INT n = m_spshwinds-> getCount (); for (int i = 0; i ITEM (V); SHDOCVW :: IWebBrowser2ptr spbroWser (SPDISP); // Generate an IE window smart pointer if (spbrowser) {// gets the IHTMLDocument2 interface IF (SUCCEEDED (spbrowser-> get_document (& SpDispatch))) pDoc2 = spDispatch; if (pDoc2 = NULL) {// AfxMessageBox ( "already acquired IHTMLDocument2");! If (SUCCEEDED (pDoc2-> get_forms (& pElementCol))) {// AfxMessageBox ( "already acquired IHTMLElementCollection "); Long p = 0; if (successmeded (pelementcol-> get_length); if (p! = 0) {for (long i = 0; i <= (p-1); i ) {v_vt (& ID) = vt_i4; v_i4 (& id) = i; v_vt (& index) = vt_i4;

V_I4 (& index) = 0; if (SUCCEEDED (pElementCol-> item (id, index, & spDispatch))) if (SUCCEEDED (spDispatch-> QueryInterface (IID_IHTMLFormElement, (void **) & pFormElement))) {// AfxMessageBox ( " IHTMLFORMELEMENT "); long Q = 0; if (succeeded (pformelement-> get_length); for (long (long j = 0; j <= (q-1); j ) {v_vt (& id) = vt_i4 ; V_I4 (& id) = j; V_VT (& index) = VT_I4; V_I4 (& index) = 0; if (SUCCEEDED (pFormElement-> item (id, index, & spDispatch))) if (SUCCEEDED (spDispatch-> QueryInterface (IID_IHTMLInputTextElement, (void **) & pInputElement))) {// AfxMessageBox ( "already acquired IHTMLInputTextElement"); CComBSTR value; CComBSTR type; pInputElement-> get_type (& type); // Get the type of the input box (or box password text boxes) CString strtype (Ty PE); start.makeupper (); if (lstrcmpi (")) == 0) {PINPUTELEMENT-> Get_Value (& value); // Get the value of the text box CSTRING STRVALUE (Value); AFXMESSAGEBOX Strvalue);}}}}}}}} Note: Please see the original code when specific details! It is best not to support the author! thanks for reading! Tanxin79@163.net, the source code of the article: http://www.vchelp.net/asp/ibr_upload/791.rar

转载请注明原文地址:https://www.9cbs.com/read-27166.html

New Post(0)