If these rules are not followed, then Delphi will crash (completely close) and you will loose any unsaved work.
These code fragments are from a working component
TmcTearoff_Windows = class(TComponent)
private
FIcon : TIcon;
procedure SetIcon(Value: TIcon);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Icon : TIcon read FIcon write SetIcon;
end;
constructor TmcTearoff_Windows.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FIcon := TIcon.Create;
FIcon.Width := GetSystemMetrics(SM_CXSMICON);
FIcon.Height := GetSystemMetrics(SM_CYSMICON);
end;
destructor TmcTearoff_Windows.Destroy;
begin
FIcon.Free;
inherited;
end;
procedure TmcTearoff_Windows.SetIcon(Value: TIcon);
begin
FIcon.Assign(Value);
end;
Author: Robert Clemenzi -
clemenzi@cpcug.org