function ShowInfo(Msg: String; iMode: Integer):integer;
begin
Case iMode of
1: Result:=Application.MessageBox(PChar(Msg+' '),'提示信息',MB_OK);
2: Result:=Application.MessageBox(PChar(Msg),PChar(Application.MainForm.Caption),MB_YESNO+MB_ICONQUESTION);
3: Result:=Application.MessageBox(PChar(Msg+' '),'错误信息',MB_OK);
4: Result:=Application.MessageBox(PChar(Msg+' '),'警告信息',MB_OK);
else Result := 0;
end;
end;
procedure TFMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := False ;
if ShowInfo(GlobalError.ExitConfirm,2)= IDYES then //MessageBox 与托盘冲突 导致系统变慢
begin
//关闭10000端口监听
IdUDPClient.Active := False ;
IdUDPServerMain.Active := False;
for i:= 0 to Self.MDIChildCount-1 do
Self.MDIChildren[i].Close ;
//设置窗体风格
if CurSKinIndex <> RegSKinIndex then
begin
WirteRegedit('SkinIndex', Encrypt(inttostr(CurSKinIndex),256));
end;
CanClose := True ;
end;
end;
begin
Case iMode of
1: Result:=Application.MessageBox(PChar(Msg+' '),'提示信息',MB_OK);
2: Result:=Application.MessageBox(PChar(Msg),PChar(Application.MainForm.Caption),MB_YESNO+MB_ICONQUESTION);
3: Result:=Application.MessageBox(PChar(Msg+' '),'错误信息',MB_OK);
4: Result:=Application.MessageBox(PChar(Msg+' '),'警告信息',MB_OK);
else Result := 0;
end;
end;
procedure TFMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := False ;
if ShowInfo(GlobalError.ExitConfirm,2)= IDYES then //MessageBox 与托盘冲突 导致系统变慢
begin
//关闭10000端口监听
IdUDPClient.Active := False ;
IdUDPServerMain.Active := False;
for i:= 0 to Self.MDIChildCount-1 do
Self.MDIChildren[i].Close ;
//设置窗体风格
if CurSKinIndex <> RegSKinIndex then
begin
WirteRegedit('SkinIndex', Encrypt(inttostr(CurSKinIndex),256));
end;
CanClose := True ;
end;
end;
begin
CanClose := False ;
if ShowInfo(GlobalError.ExitConfirm,2)= IDYES then //MessageBox 与托盘冲突 导致系统变慢
begin
//关闭10000端口监听
IdUDPClient.Active := False ;
IdUDPServerMain.Active := False;
application.processmessage;
for i:= 0 to Self.MDIChildCount-1 do
Self.MDIChildren[i].Close ;
//设置窗体风格
if CurSKinIndex <> RegSKinIndex then
begin
WirteRegedit('SkinIndex', Encrypt(inttostr(CurSKinIndex),256));
end;
CanClose := True ;
end;
end;你这个跟踪下,应该很容易找出问题