home *** CD-ROM | disk | FTP | other *** search
- unit Appunit1;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, Buttons;
-
- type
- TAppForm1 = class(TForm)
- OpenDialog1: TOpenDialog;
- TableNameEdit1: TEdit;
- OpenTableLabel1: TLabel;
- SelectBtn1: TBitBtn;
- ViewBtn1: TBitBtn;
- BitBtn1: TBitBtn;
- procedure SelectBtn1Click(Sender: TObject);
- procedure BitBtn1Click(Sender: TObject);
- procedure ViewBtn1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- AppForm1: TAppForm1;
-
- implementation
-
- {$R *.DFM}
-
- {
- These definitions will cause the service DLL to load and initialize.
- Alternatively, the DLL could be dynamically loaded and unloaded using
- LoadLibrary and FreeLibrary.
- }
-
- function UseDLL: string; far; external 'DLLPROJ1';
- procedure ExitDLL; far; external 'DLLPROJ1';
- function ViewTable (const TableName: string): string; far; external 'DLLPROJ1';
-
- procedure TAppForm1.SelectBtn1Click(Sender: TObject);
- begin
- if OpenDialog1.Execute then
- TableNameEdit1.Text := OpenDialog1.FileName
- end;
-
- procedure TAppForm1.BitBtn1Click(Sender: TObject);
- begin
- Close;
- end;
-
- procedure TAppForm1.ViewBtn1Click(Sender: TObject);
- var
- DllResult: string;
- begin
- DllResult := ViewTable (TableNameEdit1.Text);
- if Length (DllResult) <> 0 then raise Exception.Create (DllResult);
- end;
-
- {
- Since we bind statically to the demo service DLL, we check that we can
- can use it during initialization. If we dynamically loaded the DLL via
- LoadLibary, we would check at that time instead.
- }
-
- procedure CheckDLLUse;
- var
- DllResult: string;
- begin
- DllResult := UseDll;
- if Length (DllResult) <> 0 then raise Exception.Create (DllResult);
- end;
-
- { The service DLL was initialized automatically, so it must be released }
-
- begin
- CheckDLLUse;
- AddExitProc (ExitDLL);
- end.
-