注册 登录
编程论坛 C++ Builder

C++builder 调用js函数

djchao 发布于 2022-07-25 10:28, 1397 次点击
#include <vcl.h>
#pragma hdrstop

#include "Unit2.h"
#include "Comobj.hpp"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
     Variant vScript;
     vScript = CreateOleObject("MSScriptControl.ScriptControl.1");
    vScript.OlePropertySet("Language",L"JavaScript");
}
//--------------------------------------------------------------------------

提示  a script engine for the specified language can not be created
2 回复
#2
djchao2022-07-25 10:28
哪位大神遇到过,如何解决。
#3
zzz32652023-01-13 11:51
应该用 "JScript"  , 不是"JavaScript"
1