• delphi与javascript互通


    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
    
    type
      TForm1 = class(TForm)
        Memo1: TMemo;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
      uses ComObj;
      {此函数需要 ComObj 单元的支持}
    {参数 JsCode 是要执行的 Js 代码; 参数 JsVar 是要返回的变量}
    function RunJs(const JsCode, JsVar: string): string;
    var
      script: OleVariant;
    begin
      try
        script := CreateOleObject('ScriptControl');
        script.Language := 'JavaScript';
        script.ExecuteStatement(JsCode);
        Result := script.Eval(JsVar);
      except
        Result := '';
      end;
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    var
      s: string;
    begin
      s := RunJs(Memo1.Text, 'str');
      ShowMessage(s);
    end;
    
    end.

    http://www.360doc.com/content/11/1117/22/7887676_165336337.shtml

    C++Builder 资料库CSIDL_DESKTOP; //桌面
    CSIDL_DESKTOPDIRECTORY ; //桌面目录
    http://blog.csdn.net/goodai007/article/details/6942841
    http://blog.csdn.net/chiengod/article/details/309466

    //sValidation=验证

    //sCaption=功能名

    //sHint=说明或介绍

    //sCategory=类别名

    //sLocaleID=本地ID

    //sAppVerMin=版本

    //sShortcutKey=快捷键

    function main(i){

    return i*i;

    }

  • 相关阅读:
    Tcp抓包以及Tcp状态
    Wireshark抓包使用指南
    服务端tcp syn无响应,无回复
    升级openssh
    平滑升级Nginx
    Memcached 未授权访问漏洞修复
    服务端高并发分布式架构演进之路
    es索引查询与删除
    申请elasticsearch中x-pack插件许可证及授权
    独立安装ab压力测试工具及测试nginx性能
  • 原文地址:https://www.cnblogs.com/blogpro/p/11452572.html
Copyright © 2020-2023  润新知