Componentes.Terceros.RemObj.../internal/5.0.23.613/1/RemObjects SDK for Delphi/Samples/COM/COM_Main.pas
david d99a44999f - Modificación del paquete RemObjects_Core_D10 para que sea un paquete de runtime/designtime (antes era designtime sólo)
- Recompilación en Delphi10 de todos los paquetes de RO para generar las DCU's en Lib\D10

git-svn-id: https://192.168.0.254/svn/Componentes.Terceros.RemObjects@7 b6239004-a887-0f4b-9937-50029ccdca16
2007-09-10 13:36:58 +00:00

94 lines
2.5 KiB
ObjectPascal

unit COM_Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, uROPoweredByRemObjectsButton;
type
TCOM_MainForm = class(TForm)
SumButton: TButton;
TPersonButton: TButton;
MultipleCallButton: TButton;
ROPoweredByRemObjectsButton1: TROPoweredByRemObjectsButton;
procedure SumButtonClick(Sender: TObject);
procedure TPersonButtonClick(Sender: TObject);
procedure MultipleCallButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
COM_MainForm: TCOM_MainForm;
implementation
uses ComObj, ROCOM_TLB;
{$R *.dfm}
procedure TCOM_MainForm.SumButtonClick(Sender: TObject);
var
roserver,
megademoservice: OleVariant;
begin
roserver := CreateOleObject('RemObjects.SDK.COMServer');
roserver.MessageType := 'BinMessage';
roserver.ChannelType := 'HTTP';
roserver.SetChannelProperty('TargetURL', 'http://localhost:8099/bin');
megademoservice := roserver.CreateService('MegaDemoService');
ShowMessage('The result is ' + VarToStr(megademoservice.Sum(1, 2)));
end;
procedure TCOM_MainForm.TPersonButtonClick(Sender: TObject);
var
roserver,
megademoservice: OleVariant;
person: OleVariant;
begin
roserver := CreateOleObject('RemObjects.SDK.COMServer');
roserver.MessageType := 'BinMessage';
roserver.ChannelType := 'HTTP';
roserver.SetChannelProperty('TargetURL', 'http://localhost:8099/bin');
person := roserver.CreateComplexType('TPerson');
person.FirstName := 'Peter';
person.LastName := 'Miller';
person.Age := 28;
ShowMessage(person.FirstName + ' ' + person.LastName + ' ' + VarToStr(person.Age));
end;
procedure TCOM_MainForm.MultipleCallButtonClick(Sender: TObject);
var
roserver: IROCOMServer;
newservice: OleVariant;
person: OleVariant;
begin
roserver := CoROCOMServer.Create;
roserver.MessageType := 'BinMessage';
roserver.ChannelType := 'HTTP';
roserver.SetChannelProperty('TargetURL', 'http://localhost:8099/bin');
person := roserver.CreateComplexType('TPerson');
person.FirstName := 'Peter';
person.LastName := 'Baker';
ShowMessage(person.FirstName + ' ' + person.LastName);
newservice := roserver.CreateService('MegaDemoService');
ShowMessage('The result is ' + IntToStr(newservice.Sum(101, 202)));
ShowMessage('The time on the server is ' + DateTimeToStr(newservice.GetServerTime));
end;
end.