修改标准风格主窗体.actFileLogoutExecute的内容,如下
procedure TSTANDARDSTYLEMAINFORM.actFileLogoutExecute(Sender: TObject);
var
lNewMainForm: TForm;
lParent: TWinControl;
lParentWindow: THandle;
lBorderStyle: TBorderStyle;
begin
if jsDialogs.ConfirmBox('确定要注销吗?', '注销', 1) then
begin
FClosing := True;
try
FClosing := TSystemCore.FuncManager.TerminateAllFuncs(True);
except
FClosing := False;
raise;
end;
Hide;
Enabled := False; // 很重要,不然登录对话框得不到焦点
lParent := Parent;
lParentWindow := ParentWindow;
lBorderStyle := BorderStyle;
TInit.LogoffByUser;
if TInit.InitInstance.Terminated then
Exit;
{ TODO: 注销机制需要再做思考,目前会多次运行功能,IE下面的表现效果也需要重点考虑 }
lNewMainForm := TInit.InitInstance.MainForm;
if lNewMainForm <> nil then
begin
if lParent = nil then
lNewMainForm.ParentWindow := lParentWindow
else
lNewMainForm.Parent := lParent;
lNewMainForm.BorderStyle := lBorderStyle;
lNewMainForm.Show;
Borland.Delphi.Windows.PostMessage(lNewMainForm.Handle, Borland.Delphi.Messages.WM_ACTIVATE, 1, 0);
end;
// Release;
end;
end; |