The following is puzzling me, and I caanot see what is causing the error.
Everytime I try to compile the following DLL code I get an error: Unknown directive 'LargeBadgeDialog' on the pas file just before the implementation section (Marked // error here ).
If I comment out every reference to either of the ...BadgeDialog (in both Pas and Dpr) then it compiles and each section runs perfectly.
I know I could, in theory, pass a variable to one procedure to define the type of form, but unfortunately I am not allowed to do that - don't ask - politics.
Can anyone out there explain what is wrong?
The DPR code is:
library Badge_Plate;
uses
SysUtils,
Classes,
BadgePrintForm in 'BadgePrintForm.pas' {BadgePrintFrm};
Exports
SmallBadgeDialog;
LargeBadgeDialog;
begin
end.
The BadgePrintForm.Pas starts:
unit BadgePrintForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Printers,
StdCtrls, ExtCtrls, CheckLst, Db, DBTables, IniFiles, JPEG; //, LLi, llo
const
INCHES_PER_MM : real = 0.04;
type
TOffset = record
X, Y: Integer;
end;
type
TBadgePlatePrintFrm = class(TForm)
PrintBtn: TButton;
ExitBtn: TButton;
ChkLBox: TCheckListBox;
Table1: TTable;
Panel1: TPanel;
TypeRdoGrp: TRadioGroup;
GetDataBtn: TButton;
PrintDlg: TPrintDialog;
Image1: TImage;
PhotoImage: TImage;
procedure PrintBtnClick(Sender: TObject);
procedure ExitBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure printsmallbadge;
procedure printlargebadge;
function capfirst( sText : string ) : string;
procedure TypeRdoGrpClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
BadgePrintFrm: TBadgePrintFrm;
nHandle : THandle;
Procedure
SmallBadgeDialog(aHandle : THandle);
LargeBadgeDialog(aHandle : THandle); // error here
implementation
{$R *.DFM}
// DLL Called Proceduress
//==================================================
Procedure SmallBadgeDialog(aHandle : THandle);
//==================================================
begin
nHandle := Application.handle;
try
Application.handle := aHandle;
BadgePrintFrm := TBadgePrintFrm.Create(Application);
BadgePrintFrm.caption := 'Small Badge Production';
BadgePrintFrm.showmodal;
finally
BadgePrintFrm.Free;
Application.handle := nHandle;
end;
end;
//==================================================
Procedure LargeBadgeDialog(aHandle : THandle);
//==================================================
begin
nHandle := Application.handle;
try
Application.handle := aHandle;
BadgePrintFrm := TBadgePrintFrm.Create(Application);
BadgePrintFrm.caption := 'Small Badge Production';
BadgePrintFrm.showmodal;
finally
BadgePrintFrm.Free;
Application.handle := nHandle;
end;
end;
// Rest of Form procedures/functions follow....
Everytime I try to compile the following DLL code I get an error: Unknown directive 'LargeBadgeDialog' on the pas file just before the implementation section (Marked // error here ).
If I comment out every reference to either of the ...BadgeDialog (in both Pas and Dpr) then it compiles and each section runs perfectly.
I know I could, in theory, pass a variable to one procedure to define the type of form, but unfortunately I am not allowed to do that - don't ask - politics.
Can anyone out there explain what is wrong?
The DPR code is:
library Badge_Plate;
uses
SysUtils,
Classes,
BadgePrintForm in 'BadgePrintForm.pas' {BadgePrintFrm};
Exports
SmallBadgeDialog;
LargeBadgeDialog;
begin
end.
The BadgePrintForm.Pas starts:
unit BadgePrintForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Printers,
StdCtrls, ExtCtrls, CheckLst, Db, DBTables, IniFiles, JPEG; //, LLi, llo
const
INCHES_PER_MM : real = 0.04;
type
TOffset = record
X, Y: Integer;
end;
type
TBadgePlatePrintFrm = class(TForm)
PrintBtn: TButton;
ExitBtn: TButton;
ChkLBox: TCheckListBox;
Table1: TTable;
Panel1: TPanel;
TypeRdoGrp: TRadioGroup;
GetDataBtn: TButton;
PrintDlg: TPrintDialog;
Image1: TImage;
PhotoImage: TImage;
procedure PrintBtnClick(Sender: TObject);
procedure ExitBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure printsmallbadge;
procedure printlargebadge;
function capfirst( sText : string ) : string;
procedure TypeRdoGrpClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
BadgePrintFrm: TBadgePrintFrm;
nHandle : THandle;
Procedure
SmallBadgeDialog(aHandle : THandle);
LargeBadgeDialog(aHandle : THandle); // error here
implementation
{$R *.DFM}
// DLL Called Proceduress
//==================================================
Procedure SmallBadgeDialog(aHandle : THandle);
//==================================================
begin
nHandle := Application.handle;
try
Application.handle := aHandle;
BadgePrintFrm := TBadgePrintFrm.Create(Application);
BadgePrintFrm.caption := 'Small Badge Production';
BadgePrintFrm.showmodal;
finally
BadgePrintFrm.Free;
Application.handle := nHandle;
end;
end;
//==================================================
Procedure LargeBadgeDialog(aHandle : THandle);
//==================================================
begin
nHandle := Application.handle;
try
Application.handle := aHandle;
BadgePrintFrm := TBadgePrintFrm.Create(Application);
BadgePrintFrm.caption := 'Small Badge Production';
BadgePrintFrm.showmodal;
finally
BadgePrintFrm.Free;
Application.handle := nHandle;
end;
end;
// Rest of Form procedures/functions follow....