• fastscript 经验集


    implementation
    type
      TFunctions = class(TfsRTTIModule)
      private
        function CallMethod(Instance: TObject; ClassType: TClass;
          const MethodName: String; Caller: TfsMethodHelper): Variant;
      public
        constructor Create(AScript: TfsScript); override;
      end;
    
    { TFunctions }
    
    function TFunctions.CallMethod(Instance: TObject; ClassType: TClass;
      const MethodName: String; Caller: TfsMethodHelper): Variant;
    begin
      Result := 0;
      if MethodName = 'ONEKEY' then
        FrmMain.OneKey(Caller.Params[0],Caller.Params[1],Caller.Params[2],Caller.Params[3])
      else  if MethodName = 'ONEKEY2' then
        FrmMain.OneKey(Caller.Params[0],Caller.Params[1])
      else if MethodName = 'GETTEXT' then
        Result := FrmMain.GetText(Caller.Params[0])
      else if MethodName = 'NEXTLINE' then
        FrmMain.NextLine
      else if MethodName = 'SLEEP' then
         Sleep1(FrmMain.se.Value)
      else if MethodName = 'QUERYCANCEL' then
         Result := FrmMain.FCancel;
    end;
    
    constructor TFunctions.Create(AScript: TfsScript);
    begin
      inherited Create(AScript);
      AScript.AddMethod('procedure OneKey(key1:Byte; ext1:Boolean;key2:Byte; ext2:Boolean)', CallMethod);
      AScript.AddMethod('procedure OneKey2(key:Byte; ext:Boolean = false)', CallMethod);
      AScript.AddMethod('function GetText(i: Integer):string', CallMethod);
      AScript.AddMethod('procedure NextLine', CallMethod);
      AScript.AddMethod('procedure sleep', CallMethod);
      AScript.AddMethod('function querycancel:boolean', CallMethod);
    end;
    
    
    
    initialization
      fsRTTIModules.Add(TFunctions);
    
    finalization
      fsRTTIModules.Remove(TFunctions);
    end.
    View Code
  • 相关阅读:
    python pycurl属性
    HTTP报文-->MVC
    国际化信息-->MVC
    计算机网络入门概念理解
    TCP/IP基础概念及通信过程举例
    一道面试题:说说进程和线程的区别
    【转载】我眼中的Oracle性能优化
    【转载】数据库范式那些事
    【转载】详解CreateProcess调用内核创建进程的过程
    数据结构和算法(一):hash散列容器
  • 原文地址:https://www.cnblogs.com/khzide/p/4460346.html
Copyright © 2020-2023  润新知