zoukankan      html  css  js  c++  java
  • 取得IE,然后运行本地JS

    void EnumIE( void )
    {
    	CString jscript="function Vote(id,position) {if(datelimit()){$get(\"dropdownlistPosition\").value=(position==\"0\")?\"\":position; $get(\"dropdownlistPosition\").disabled=true;  $get(\"inputHiddenHideId\").value=id;$get(\"buttonVoteTemp\").click();} else {alert(\"投票暂停!\");}};\
    					function OnCheckValidateCode(result){ switch(result) {case \"cookie\":alert(\"浏览器需允许Cookie!\"); return; break;case \"error\":return;default: return SaveRecord(\"SAVE\");break; }};\
    					function OnVote(result)  { switch(result) {case \"false\": alert(\"投票失败!\"); break; case \"popedom\": alert(\"今天已达投票10次限制!\"); break; default: NewValidateCode(); $get(\"inputValidateCode\").value=\"\"; __doPostBack('buttonRefreshGridView','');  ResetForm(); break; }};\
    					function getCookie(name){    var arr = document.cookie.match(new RegExp(\"(^| )\"+name+\"=([^;]*)(;|$)\"));     if(arr != null) return unescape(arr[2]); return null;};\
    					Vote('755','38');$get(\"inputValidateCode\").value=getCookie(\"ValidateCode\");SaveAndClose();";
    //Vote('149','0') 挂公司
    	CComPtr< IShellWindows > spShellWin;
    	HRESULT hr = spShellWin.CoCreateInstance( CLSID_ShellWindows );
    	if ( FAILED ( hr ) )
    	{
    		return;
    	}
     
    	long nCount = 0;		// 取得浏览器实例个数(Explorer 和 IExplorer)
    	spShellWin->get_Count( &nCount );
    	if( 0 == nCount )
    	{
    		return;
    	}
     
    	for(int i=0; i<nCount; i++)
    	{
    		CComPtr< IDispatch > spDispIE;
    		hr=spShellWin->Item(CComVariant( (long)i ), &spDispIE );
    		if ( FAILED ( hr ) )	continue;
     
    		CComQIPtr< IWebBrowser2 > spBrowser = spDispIE;
    		if ( !spBrowser )		 continue;
     
    		CComPtr < IDispatch > spDispDoc;
    		hr = spBrowser->get_Document( &spDispDoc );
    		if ( FAILED ( hr ) )	continue;
     
    		CComQIPtr< IHTMLDocument2 > spDocument2 = spDispDoc;
    		if ( !spDocument2 ) 	   continue;
     
    		// 程序运行到此,已经找到了 IHTMLDocument2 的接口指针
    		
    		IHTMLWindow2 *pWindow;
    		hr=spDocument2->get_parentWindow(&pWindow);
    		if( ! pWindow)	continue;
    		
    		VARIANT ret;
    		ret.vt=VT_EMPTY;
    		VARIANT pVal;
    		hr=pWindow->execScript(CComBSTR(jscript),L"javascript",&pVal);
     
    	}
    	spShellWin=NULL;
    }
    

      

  • 相关阅读:
    MongoDB 之 手把手教你增删改查 MongoDB
    MongoDB 之 你得知道MongoDB是个什么鬼 MongoDB
    全栈12期的崛起之捡点儿有用的说说
    Python 常用模块
    Python3中的内置函数
    Python程序员之面试必回习题
    Django之初始庐山真面目
    Django之ORM操作
    MySQL-索引
    MySQL-函数
  • 原文地址:https://www.cnblogs.com/jevan/p/2284302.html
Copyright © 2011-2022 走看看