OmniThreadLibrary 传递数据

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
       case msg.MsgID of
         1:
         begin
            ClientDataSet2.Data := msg.MsgData.AsVariant;
            ClientDataSet2.Open;
         end;
         2:Label1.Caption := 'start';
         3:Label1.Caption :='end';
         4:Label1.Caption := 'sleep';
       end;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
    procedure GetAll( const task:IOmniTask);
    var
      aa:TClientRuleClient;
      f:OleVariant;
      msgData: TOmniValue;
      msgID  : word;
    begin
      task.Comm.Send(2,'start');
      Form1.ClientDataSet2.Close;
      aa:=TClientRuleClient.Create(Form1.SQLConnection1.DBXConnection);
      f:= aa.GetAll;
      FreeAndNil(aa);
     // Form1.ClientDataSet2.Data := f;
      if task.Comm.Receive(msgID,msgData) then begin
         if msgID = 0 then Exit;
      end;
      task.Comm.Send(4,'sleep');
      Sleep(3000);
    
      task.Comm.Send(3,'end');
      task.Comm.Send(1, tomnivalue.CastFrom(f));
    end;
Licensed under CC BY-NC-SA 4.0
记录平时瞎折腾遇到的各种问题, 方便查找
使用 Hugo 构建
主题 Stack 3.29.0Jimmy 设计