Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÔÚC++ÖÐÓÃWebBrowser¿Ø¼þµ÷ÓÃJavaScriptº¯Êý

Ö÷Òªº¯Êý CallJScript
BOOL CallJScript(const wchar_t * func, VARIANT * vtParams, int cNumberOfParam, VARIANT * vtResult)
{
if(!func || !func[0])
return FALSE;
CComPtr<IDispatch> spScript;
spScript = GetJScript();
if(!spScript)
return FALSE;
DISPID dispID = NULL;
CComBSTR bstrFunc(func);
HRESULT hr = spScript->GetIDsOfNames(IID_NULL, &bstrFunc, 1, LOCALE_SYSTEM_DEFAULT, &dispID);
if(FAILED(hr))
return FALSE;
DISPPARAMS dispParams = {0};
dispParams.cArgs = cNumberOfParam;
dispParams.rgvarg = new VARIANT[cNumberOfParam];
for(int i = 0; i < cNumberOfParam; ++i)
{
VariantInit(&dispParams.rgvarg[i]);
VariantCopy(&dispParams.rgvarg[i], &vtParams[cNumberOfParam - 1 - i]);
}
hr = spScript->Invoke(dispID, IID_NULL, 0, DISPATCH_METHOD, &dispParams, vtResult, NULL, NULL);
delete [] dispParams.rgvarg;
if(FAILED(hr))
return FALSE;
return TRUE;
}
ÆäËüº¯Êý
IHTMLDocument2 * GetIDocument2()
{
if(!m_pWebBrowser2) return NULL;
IDispatch *pIDispatch = NULL;
if (SUCCEEDED(m_pWebBrowser2->get_Document(&pIDispatch)) && pIDispatch)
{
IHTMLDocument2 *pIDocument2 = NULL;
if (SUCCEEDED(pIDispatch->QueryInterface(IID_IHTMLDocument2, (void**)&pIDocument2)))
{
pIDispatch->Release();
return pIDocument2;
}
pIDispatch->Release();
}
return NULL;
}
IDispatch * GetJScript()
{
CComPtr<IHTMLDocument2> doc;
doc = GetIDocument2();
if(!doc)
return NULL;
IDispatch * dsScript = NULL;
HRESULT hr = doc->get_Script(&dsScript);
if(SUCCEEDED(hr) && dsScript)
return dsScript;
else
return NULL;


Ïà¹ØÎĵµ£º

eclipse javascript²å¼þ

 Ò»¡£eclipse ÅäÖÃspket
spketÊÇÒ»¸öдJSµÄ²å¼þ
ÎÒµÄÅäÖû·¾³ÊÇ
eclipse3.2
spket-1.6.11.jar
1.°²×°spket-1.6.11.jar,
°Ñspket°ü¿½±´µ½Ò»¸öÄãÄܼǵÄסµÄĿ¼ÏÂ,ÎÒÕâ·ÅÔÚe:¸ùĿ¼ÏÂ
½Ó׎øÈëDOSÏÂ,½øÈëd:¸ùĿ¼,ÊäÈëJAVA -jar spket-1.6.11.jarÃüÁî
Ö®ºó»áÌáʾÄã°²×°spket,°´×ÅËûÌáʾµÄÒ»Ö±ÏÂÒ»²½,Öмä»áÌáÊ¾Ä ......

JavascriptÖÐ×î³£ÓõÄ55¸ö¾­µä¼¼ÇÉ

 1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)> <td>no </table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return false;" onc ......

JavascriptÖÐ×î³£ÓõÄ55¸ö¾­µä¼¼ÇÉ

 1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)> <td>no </table> ¿ÉÓÃÓÚTable

2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ

3. onpaste="return false&quo ......

JavaScript±íµ¥ÑéÖ¤´óÈ«£¨Ò»£©

Ŀ¼:
1:js ×Ö·û´®³¤¶ÈÏÞÖÆ¡¢ÅжÏ×Ö·û³¤¶È ¡¢jsÏÞÖÆÊäÈë¡¢ÏÞÖƲ»ÄÜÊäÈë¡¢textarea ³¤¶ÈÏÞÖÆ
2.:jsÅжϺº×Ö¡¢ÅжÏÊÇ·ñºº×Ö ¡¢Ö»ÄÜÊäÈ뺺×Ö
3:jsÅжÏÊÇ·ñÊäÈëÓ¢ÎÄ¡¢Ö»ÄÜÊäÈëÓ¢ÎÄ
4:jsÖ»ÄÜÊäÈëÊý×Ö,ÅжÏÊý×Ö¡¢ÑéÖ¤Êý×Ö¡¢¼ì²âÊý×Ö¡¢ÅжÏÊÇ·ñΪÊý×Ö¡¢Ö»ÄÜÊäÈëÊý×Ö
5:Ö»ÄÜÊäÈëÓ¢ÎÄ×Ö·ûºÍÊý×Ö
6: js emailÑéÖ¤ ¡¢js ÅжÏemai ......

C/C++·¢Õ¹ÀúÊ·¼òµ¥½éÉÜ

 CÓïÑÔÖ®ËùÒÔÒªÆðÃûΪ“C”£¬ÊÇÒòΪËüÊÇÖ÷Òª²Î¿¼ÄǸöʱºòµÄһÎÐBµÄÓïÑÔ£¬ËüµÄÉè¼ÆÕßÈÏΪCÓïÑÔÊÇBÓïÑԵĽø²½£¬ËùÒÔ¾ÍÆðÃûΪCÓïÑÔ£»µ«ÊÇBÓïÑÔ²¢²»ÊÇÒòΪ֮ǰ»¹ÓиöAÓïÑÔ£¬¶øÊÇBÓïÑÔµÄ×÷ÕßΪÁ˼ÍÄîËûµÄÆÞ×Ó£¬ËûµÄÆÞ×ӵĵÚÒ»¸ö×ÖĸÊÇB£»
    µ±CÓïÑÔ·¢Õ¹µ½¶¥·åµÄʱ¿Ì£¬³öÏÖÁËÒ»¸ö°æ±¾½ÐC with ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ