如何退出程序?
梅文海 2002-01-31 11:47:06 1.出于需要,在程序中先加载了数据模块,而不是主模块(如果是主模块便不存在这种情况了)。
2.然后分别加载了等待画面、登陆、和主模块。
程序平时在主模块退出时,没有任何问题,但在某些情况下会出错(程序退出,但用任务管理器察看仍然存在),我的资源释放全部是在主模块的OnCloseQuery中完成的,请教各位,有没有办法在资源释放不完全的情况下,将Application释放。
我得OnCloseQuery是这样的:
procedure TfrMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
try
if cfConfigFile<>nil then cfConfigFile.Free;
dispose(pSearchPer);
dmDataSource.dbSource.Connected:=False;
dmDataSource.CloseMe;
if frMateriel<>nil then frMateriel.CloseMe;
if frDefaultValue<>nil then frDefaultValue.CloseMe;
if frInfo<>nil then frInfo.CloseMe;
if frCurrencyList<>nil then frCurrencyList.CloseMe;
if frCurrencyInputAmend<>nil then frCurrencyInputAmend.CloseMe;
if frOtherReport<>nil then frOtherReport.CloseMe;
if frMyPreview<>nil then frMyPreview.CloseMe;
if frCurrencySearch<>nil then frCurrencySearch.CloseMe;
frLogin.Close;
except
on E:Exception do
myMessageBox(E.Message);
end;
end;