Fill Input Field in IE

zhaozj2021-02-16  52

// Fill INPUT FIELD IN IE // if IT Works, IT IS Written By Masterz, OtherWise I don't // KNOW WHO WRITES IT ^ _ ^ /// iport // Internet Explorer 5 # import #include "shlwapi.h" #pragma comment (lib, "shlwapi.lib") int _tmain (int Argc, _tchar * argv [] citialize (null); shdocvw :: ishellwindowsptr m_spshwinds; if ( m_spSHWinds.CreateInstance (__ uuidof (SHDocVw :: ShellWindows)) == S_OK) {IDispatchPtr spDisp; long nCount = m_spSHWinds-> GetCount (); for (long i = 0; i Item (va); SHDocVw :: IWebBrowser2Ptr spBrowser (spDisp); if (spBrowser = NULL) {IDispatchPtr spDisp;! if (spBrowser-> get_Document (& spDisp)! == S_OK && spDisp = 0) {MSHTML :: IHTMLDocument2Ptr spHtmlDocument (spDisp); MSHTML :: IHTMLElementPtr spHtmlElement; if (spHtmlDocument == NULL) continue; spHtmlDocument-> get_body (& spHtmlElement); if (spHtmlDocument == NULL) continue; HRESULT hr; MSHTML :: IHTMLElementColle Ction * pcoll = null; hr = sphtmldocument-> get_all (& pcoll); if (pcoll! = null && succeeded (hr)) {long lcount = 0; PCOLL-> get_length (& lcount); for (int i = 0; i item (index, index); if (DISP == NULL) HR = E_FAIL; Else {MSHTML :: IHTMLINPUTELEMENTPTR PINPUT (Disp); IF (PINPUT) {BSTR BSTRTYPE; PINPUT-> GET_TYPE (& BSTRTYPE);

Printf (_BSTR_T (BSTRTYPE)); IF (strcmpw (BSTRTYPE, L "text") == 0) {PINPUT-> PUT_VALUE (_BSTR_T ("Fill IT"); Printf ("Fill A Field / N");} Sysfreestring (bstrtype);}}} PCOLL-> Release ();}}

}

} Else {printf ("Shell Windows Interface Is Not Avila / N");} Couninitialize (); Return 0;}

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

New Post(0)