如何将此 VB6 代码转换为 Delphi?
strConv(a, vbUnicode)
和
Private cScript As New ScriptControl
cScript.Language = "Javascript"
cScript.Reset
cScript.AddCode StrConv(LoadResData(101, "RSADATA"), vbUnicode)
cScript.Run("createRsaKey", data1 , data2)
如何将此 VB6 代码转换为 Delphi?
strConv(a, vbUnicode)
和
Private cScript As New ScriptControl
cScript.Language = "Javascript"
cScript.Reset
cScript.AddCode StrConv(LoadResData(101, "RSADATA"), vbUnicode)
cScript.Run("createRsaKey", data1 , data2)
首先:我同意@DavidHeffernan:请(非常请)寻找一种在 Delphi 中执行逻辑的方法。
按着这些次序:
然后使用TScriptControl
对象的一个实例,可能是这样的:
var
sc:TScriptControl;
sa:PSafeArray;
code:WideString;
rs:TResourceStream;
begin
rs:=TResourceStream.Create(HInstance,'RSADATA',MakeIntResource(101));
try
SetLength(code,rs.Size div 2);
rs.Read(PWideChar(code)^,rs.Size);
finally
rs.Free;
end;
sc:=TScriptControl.Create(nil);
try
sc.Language:='Javascript';
sc.Reset;
sc.AddCode(code);
sa:=PSafeArray(TVarData(VarArrayOf([data1,data2])).VArray);
sc.Run('createRsaKey',sa);
finally
sc.Free;
end;
end;