The following is a dpr framework
.....
const
APP_FLAG = 'LON-METER-READER';
var
app_atom : ATOM;
begin
Application.Initialize;
app_atom := globalFindAtom(APP_FLAG);
try
if app_atom <> 0 then begin //only allow one instance
Application.Terminate ;
end
else begin
splash_frm := Tsplash_frm.create(Application);
splash_frm.show;
splash_frm.update;
app_atom := globalAddAtom(APP_FLAG);
try
try
DM := TDM.Create(application);
except
//can not come here even if there is a exception
//in TDM's onCreate method as below
raise;
end;
login_frm := Tlogin_frm.create(application);
finally
splash_frm.hide;
splash_frm.free;
end;
if login_frm.ShowModal <> idOk then begin
application.Terminate;
exit;
end;
Application.CreateForm(Tmain_frm, main_frm);
Application.Run;
end;
finally
//do cleanup work
globalDeleteAtom(app_atom);
login_frm.free;
DM.free;
end;
end.
procedure TDM.DataModuleCreate(Sender: TObject);
begin
...
try
myDB.Connected := true;
except
raise; //will raise exception here
end;
end;
----------------------------------------------
I donot know why i cannot catch the exception raised by TDM.DataModuleCreate
Any suggestion is appreciated ! ipo_z@cmmail.com
garbage in,garbage out
.....
const
APP_FLAG = 'LON-METER-READER';
var
app_atom : ATOM;
begin
Application.Initialize;
app_atom := globalFindAtom(APP_FLAG);
try
if app_atom <> 0 then begin //only allow one instance
Application.Terminate ;
end
else begin
splash_frm := Tsplash_frm.create(Application);
splash_frm.show;
splash_frm.update;
app_atom := globalAddAtom(APP_FLAG);
try
try
DM := TDM.Create(application);
except
//can not come here even if there is a exception
//in TDM's onCreate method as below
raise;
end;
login_frm := Tlogin_frm.create(application);
finally
splash_frm.hide;
splash_frm.free;
end;
if login_frm.ShowModal <> idOk then begin
application.Terminate;
exit;
end;
Application.CreateForm(Tmain_frm, main_frm);
Application.Run;
end;
finally
//do cleanup work
globalDeleteAtom(app_atom);
login_frm.free;
DM.free;
end;
end.
procedure TDM.DataModuleCreate(Sender: TObject);
begin
...
try
myDB.Connected := true;
except
raise; //will raise exception here
end;
end;
----------------------------------------------
I donot know why i cannot catch the exception raised by TDM.DataModuleCreate
Any suggestion is appreciated ! ipo_z@cmmail.com
garbage in,garbage out