JavaScript函数代码:
function A()
{
return 5;
}
VC代码:
CScriptControl Test;
CRect rect;
Test.Create("TestScript",0,rect,this,100);
Test.SetLanguage("JavaScript");
CString strStat="function A(){"return 5;"} ret=A();"
Test.AddCode(strStat);
VARIANT A=Test.Eval("ret");
AfxMessageBox(_bstr_t(A));
这样就可以做到脚本与调用程序的交互了
本文地址:http://com.8s8s.com/it/it25336.htm