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

ÔÚJavaScript µ÷ÓÃC++

·½°¸Ò»£º
// html & JavaScript
...
<button value="Click me"
onclick="window.navigate('app:command&arg1=1&arg2=2')" />
...
 // C++: ÏìÓ¦ µÄÏûÏ¢º¯ÊýOnBeforeNavigat2 
virtual void OnBeforeNavigate2( LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName,
CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel );
// C++ code goes here
CXXXDlg::OnBeforeNavigate2( LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName,
CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel )
{
CString strUrl = lpszURL;
if(strUrl.Left(4) == _T("app:"))
{
// cancel the common url navigate and call your c++ code here
*pbCancel = TURE;
// call other c++ function here or parse the argument in the strUrl

}
// go common url navigate here

}

·½°¸¶þ£º
// html & javaScript
...
function CallCpp()
{
alert('start to call cpp here');
window.external.JavaScriptCallCpp('This
is a test for call C++ in JavaScript');
}
<button onclick="CallCpp()"
>JavaScript·ÃÎÊC++´úÂë</button>
...
// C++ code goes here
CString javaScriptName =
_T("JavaScriptCallCpp");
#define DISPID_CallCppfromJs 1
// ʵÏÖIDispatch ½Ó¿Ú
// .h
class CImpIDispatch : public IDispatch
{
protected:
ULONG m_cRef;
public:
CImpIDispatch(void);
~CImpIDispatch(void);
STDMETHODIMP QueryInterface(REFIID, void **);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
//IDispatch
STDMETHODIMP GetTypeInfoCount(UINT* pctinfo);
STDMETHODIMP GetTypeInfo(/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo** ppTInfo);
STDMETHODIMP GetIDsOfNames(
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [in] */ UINT cNames,


Ïà¹ØÎĵµ£º

C/C++µ¥Ôª²âÊÔÀíÂÛ¾«Òª£¨°Ë£©

µÚ3Õ ÔõÑù²ÅÄܸßЧÂʲâÊÔ
3.1 ËÆÊǶø·ÇµÄ¸ßЧÂÊ
 
    ÕâÒ»½Ú³ÎÇåһЩÁ÷ÐеÄÎó½â»òÎóµ¼£¬Ò»Ð©¿´ÆðÀ´ºÜ²»´íµÄ¸ßЧÂÊ£¬Êµ¼ÊÉÏÊÇËÆÊǶø·ÇµÄ¡£
È«×Ô¶¯Éú³ÉÓÃÀý
    È«×Ô¶¯Éú³ÉÓÃÀýÊÇËùÓвâÊÔÈËÔ±µÄÆÚÅΣ¬ºÃÏûÏ¢ÊÇ£¬ÕâÊÇÒ»ÖÖ¼òµ¥µÄ¼¼Êõ£¬Ê®ÄêÇ°¾ÍÓÐÁË£¬»µÏûÏ¢ÊÇ£¬ÕâÖÖ¼¼Êõ×÷ÓúÜС¡£
......

C/C++ÖÐStaticµÄ×÷ÓÃÏêÊö


C/C++ÖÐStaticµÄ×÷ÓÃÏêÊö
http://developer.51cto.com  2008-12-29 09:52  ØýÃû  ÖйúITʵÑéÊÒ  ÎÒÒªÆÀÂÛ(0)
CÓïÑÔÖУ¬staticµÄ×ÖÃæÒâ˼ºÜÈÝÒ×°ÑÎÒÃǵ¼ÈëÆç;¡£±¾ÎĽ«¶ÔC/C++ÖÐStatic½øÐÐÏêÊö¡£
1.ÏÈÀ´½éÉÜËüµÄµÚÒ»ÌõÒ²ÊÇ×îÖØÒªµÄÒ»Ìõ£ºÒþ²Ø¡£
µ±ÎÒÃÇͬʱ±àÒë¶à¸öÎļþʱ£¬ËùÓÐδ¼Óstaticǰ׺µÄÈ ......

JavaScript Calls from C++

×î½üÒªÓõ½Ïà¹Ø¼¼Êõ£¬ÏÈÌùÔÚÕ⣬ÓпÕÔÙ·­Ò³¡£
±¾ÎÄת×Ô£º
http://www.codeguru.com/Cpp/I-N/ieprogram/article.php/c4399
http://www.codeguru.com/cpp/i-n/ieprogram/article.php/c4399/JavaScript-Calls-from-C.htm
http://www.codeproject.com/KB/COM/jscalls.aspx

Introduction
Sometimes, when we are usi ......

[C/C++] °ÑÒ»¸öÕûÐÍÕûÊýת³É×Ö·û´®

ÎÊÌâÃèÊö£ºÐ´Ò»¸öº¯Êý£¬½ÓÊÜÒ»¸öÕûÊý£¨¼Ù¶¨ÓÃint±íʾ£©£¬Êä³ö¸ÃÕûÊýµÄ×Ö·û´®ÐÎʽ¡£²ÉÓÃÈçϺ¯ÊýÔ­ÐÍ£º
void itoa ( int val, char* buf );

ÕâÀï¼Ù¶¨buf×ã¹»´óÒÔÈÝÄÉÈκÎintÀàÐÍÊýÖµµÄ×Ö·û´®¡£
Õâ¸öÎÊÌ⣬³õ¿´ºÃÏñûÓÐʲôÄѶȡ£Èç¹ûÊÇ0£¬¾ÍÖ±½ÓÊä³ö'0'£»Èç¹ûÊÇÕýÊý£¬¾Íͨ¹ýÈ¡Ä£(%)ºÍÇóÉÌ(/)ÔËËã¿ÉÒÔÖðλȡµÃ¸ÃÕûÊýµÄÊ ......

ÓÀÔ¶Éñ»°——C#/C/C++µ½µ×»¹ÄÜ×öʲô£¿

http://blog.csdn.net/tonyxiaohome/archive/2010/04/27/5536367.aspx
ÎÒ¿´ÁËÒÔºóÎÒҲ˵¼¸¾ä£¬ËãÎÒÔÚITÐÐÒµ´òƴһЩ¾­Ñé¡£
 Ê×ÏÈÕâ¸ö»°ÌâʵÔÚÊÇÌ«´óÁË¡£
C++ °üÀ¨C²»£¿
Æ»¹û¡¢Ò»Ð©Èí¼þ ±ÈÈçMysql£¬sqlite ¶¼ÊÇÄ£¿é»¯ÎªÖ÷
»ù±¾¾ÍÊÇCÓïÑÔ¡£
 Ê×ÏÈÎÒ²»ÈÏͬ C++°üÀ¨C¡£
Õâ¸ö»°Ìâ ¾ÍÓÐÎÊÌâ¡£
ÎÒÃǸĸĿ´  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ