RPC HELP TParams Assign Example

From VistApedia
Jump to: navigation, search

Assign Example (TParams Class)

The following program code demonstrates how a TParams assign method can be used to save off the TRPCB component parameters and restore them later:


   procedure TForm1.Button1Click(Sender: TObject);
   var
     SaveParams: TParams;
     SaveRemoteProcedure: string;
   begin
     {create holding variable with Form1 as owner}
     SaveParams := TParams.Create(self);
     {save parameters}
     SaveParams.Assign(brkrRPCBroker1.Param);
     SaveRemoteProcedure := brkrRPCBroker1.RemoteProcedure;
     brkrRPCBroker1.RemoteProcedure := 'SOME OTHER PROCEDURE';
     brkrRPCBroker1.ClearParameters := True;
     brkrRPCBroker1.Call;
     {restore parameters}
     brkrRPCBroker1.Param.Assign(SaveParams);
     brkrRPCBroker1.RemoteProcedure := SaveRemoteProcedure;
     {release memory}
     SaveParams.Free;
   end;