VC uses the Script control to execute the JavaScript function and get JavaScript return value

xiaoxiao2021-03-06  59

JavaScript function code:

Function a () {return 5;}

VC code: CScriptControl test; create.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));

This will make the script and the calling program interaction.

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

New Post(0)