home *** CD-ROM | disk | FTP | other *** search
- unit MainTest;
-
- { This is the client half of a 'simplest possible case' Delphi Automation
- example. Before this program will work correctly, you need to compile and run
- the AutoProj example program. When you run AutoProj, pass in /regserver as a
- parameter using the Run|Parameters dialog. }
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls;
-
- type
- TForm1 = class(TForm)
- bRunAuto: TButton;
- procedure bRunAutoClick(Sender: TObject);
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- uses
- OleAuto;
-
- procedure TForm1.bRunAutoClick(Sender: TObject);
- var
- V: Variant;
- begin
- try
- V := CreateOleObject('AutoProj.MyAuto');
- V.ShowDialog;
- V.MyProp := 'This string was passed to the MyProp property ' +
- 'of AutoProj by TestAp';
- V.ShowDialog;
- except
- on E: Exception do
- begin
- Application.HandleException(E);
- ShowMessage('Make sure you compile AutoProj first and run it either ' +
- 'from the commmand line with the /regserver switch or from ' +
- 'Delphi after you set the Run|Parameters dialog to /regserver');
- end;
- end;
- end;
-
- end.
-