Discussion:
KOL. Closing DLL form, close application
(too old to reply)
h***@poczta.onet.pl
2008-01-09 22:28:15 UTC
Permalink
Raw Message
Hi. Sorry for my English, I'm from Poland
So. I'm beginner KOL user. I try do simple plugin form my internet
comunicator. I create new DLL Project, create blank VCL form and put
in this form components KOLForm and KOLProject. I use as example
"empty" and "2forms" demos.

This is my MainFormUnit:
{ KOL MCK } // Do not remove this line!
{$DEFINE KOL_MCK}
unit MainFormUnit;

interface

{$IFDEF KOL_MCK}
uses Windows, Messages, ShellAPI, KOL {$IFNDEF KOL_MCK}, mirror,
Classes,
Controls, mckCtrls {$ENDIF};
{$ELSE}
{$I uses.inc}
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs;
{$ENDIF}

type
{$IFDEF KOL_MCK}
{$I MCKfakeClasses.inc}
{$IFDEF KOLCLASSES} TForm1 = class; PForm1 = TForm1; {$ELSE OBJECTS}
PForm1 = ^TForm1; {$ENDIF CLASSES/OBJECTS}
{$IFDEF KOLCLASSES}{$I TForm1.inc}{$ELSE} TForm1 = object(TObj)
{$ENDIF}
Form: PControl;
{$ELSE not_KOL_MCK}
TForm1 = class(TForm)
{$ENDIF KOL_MCK}
KOLForm1: TKOLForm;
KOLProject1: TKOLProject;
procedure KOLForm1Destroy(Sender: PObj);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1 {$IFDEF KOL_MCK} : PForm1 {$ELSE} : TForm1 {$ENDIF} ;

{$IFDEF KOL_MCK}
procedure NewForm1( var Result: PForm1; AParent: PControl );
{$ENDIF}

implementation

{$IFNDEF KOL_MCK} {$R *.DFM} {$ENDIF}

{$IFDEF KOL_MCK}
{$I MainFormUnit_1.inc}
{$ENDIF}

procedure TForm1.KOLForm1Close(Sender: PObj);
begin
Form1 := nil;
end;

end.

...and create and open:
if not Assigned(Form1) then
NewForm1(Form1, nil);
Form1.Form.Show;

... but when I close this form, comunicator is terminated without any
exceptions. Why? What is wrong? Mybe this NewForm1(Form1, nil) - this
form dont have parent.

Greetings
h***@poczta.onet.pl
2008-01-09 22:33:25 UTC
Permalink
Raw Message
sorry, in close:

procedure TForm1.KOLForm1OnClose(Sender: PObj);
begin
Self.Form.Free;
end;

Loading...