B
baoling
Unregistered / Unconfirmed
GUEST, unregistred user!
unit CCHModule;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TCCHModule = class(TComponent)
private
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(AOwner: TComponent); override;
constructor CreateNew(AOwner: TComponent; Dummy: Integer = 0); virtual;
destructor Destroy; override;
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('CCH', [TCCHModule]);
end;
constructor TCCHModule.Create(AOwner: TComponent);
begin
GlobalNameSpace.BeginWrite;
try
CreateNew(AOwner);
if (ClassType <> TCCHModule) then
begin
if not InitInheritedComponent(Self, TCCHModule) then
raise EResNotFound.CreateFmt(SResNotFound, [ClassName]);
end;
finally
GlobalNameSpace.EndWrite;
end;
end;
constructor TCCHModule.CreateNew(AOwner: TComponent; Dummy: Integer);
begin
inherited Create(AOwner);
Screen.AddForm(Self);
end;
destructor TCCHModule.Destroy;
begin
GlobalNameSpace.BeginWrite;
try
Screen.RemoveForm(Self);
inherited Destroy;
finally
GlobalNameSpace.EndWrite;
end;
end;
end.
//编译时 SResNotFound AddForm ReMoveForm说是没有声明 可为什么在forms.pas中的
TCustomForm.CreateNew中却是可用的?
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TCCHModule = class(TComponent)
private
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(AOwner: TComponent); override;
constructor CreateNew(AOwner: TComponent; Dummy: Integer = 0); virtual;
destructor Destroy; override;
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('CCH', [TCCHModule]);
end;
constructor TCCHModule.Create(AOwner: TComponent);
begin
GlobalNameSpace.BeginWrite;
try
CreateNew(AOwner);
if (ClassType <> TCCHModule) then
begin
if not InitInheritedComponent(Self, TCCHModule) then
raise EResNotFound.CreateFmt(SResNotFound, [ClassName]);
end;
finally
GlobalNameSpace.EndWrite;
end;
end;
constructor TCCHModule.CreateNew(AOwner: TComponent; Dummy: Integer);
begin
inherited Create(AOwner);
Screen.AddForm(Self);
end;
destructor TCCHModule.Destroy;
begin
GlobalNameSpace.BeginWrite;
try
Screen.RemoveForm(Self);
inherited Destroy;
finally
GlobalNameSpace.EndWrite;
end;
end;
end.
//编译时 SResNotFound AddForm ReMoveForm说是没有声明 可为什么在forms.pas中的
TCustomForm.CreateNew中却是可用的?