我把系统加了这么多显示语句,但是在那台机器上什么都没显示,依然有进程!!!
在我这里一切正常,
const
CM_RESTORE = WM_USER + $1001;
HDL_APP_NAME = 'HFA300';
var
RvHandle:HWND;
B_OPLog:Boolean;
begin
MessageAlert('First');
RvHandle := FindWindow(HDL_APP_NAME,nil);
if(RvHandle >0)then
begin
MessageAlert('Second');
PostMessage(RvHandle,CM_RESTORE,0,0);
Application.Terminate;
//PostQuitMessage(0);
//Exit;
end;
MessageAlert('Third');
Application.Initialize;
MessageAlert('After Initialize');
Application.Title := 'HFA300S Manage System';
Application.CreateForm(TDM_HDL, DM_HDL);
MessageAlert('After CreateForm(TDM_HDL, DM_HDL)');
Frm_Login:=TFrm_Login.Create(nil);
MessageAlert('TFrm_Login.Create(nil)');
B_OPLog:=True;
MessageAlert('After B_OPLog:=True');
Frm_Login.ShowForm(B_OPLog);
MessageAlert('After Frm_Login.ShowForm(B_OPLog)');
if B_OPLog then
begin
MessageAlert('Before Frm_Login.Close;');
Frm_Login.Close;
MessageAlert('After Frm_Login.Close;');
Application.ShowMainForm := True;
MessageAlert('After Application.ShowMainForm := True;');
Application.CreateForm(TFrm_Main, Frm_Main);
MessageAlert('After CreateForm(TFrm_Main, Frm_Main)');
Application.Run;
MessageAlert('After Application.Run');
end
else
begin
MessageAlert('Before if DM_HDL.AdoConnect.Connected then
');
if DM_HDL.AdoConnect.Connected then
DM_HDL.AdoConnect.Close;
MessageAlert('Before DM_HDL.Free');
DM_HDL.Free;
MessageAlert('After DM_HDL.Free');
PostQuitMessage(0);
end;
end.