zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    第09组(71) Alpha冲刺 (3/6)
    第09组 Alpha冲刺 (2/6)
    第09组 Alpha冲刺 (1/6)
    第09组(71)需求分析报告
    第07组 Beta冲刺(1/5)
    第07组 Alpha冲刺 总结
    第07组 Alpha冲刺 (6/6)
    第07组 Alpha冲刺 (5/6)
    第五次作业
    第07组 Alpha冲刺 (4/6)
  • 原文地址:https://www.cnblogs.com/khzide/p/4460346.html
Copyright © 2011-2022 走看看