unit xDialogs; interface Uses Forms, Dialogs; type TSaveDialog=class(Dialogs.TSaveDialog) public function Execute:boolean; override; end; TOpenDialog=class(Dialogs.TOpenDialog) public function Execute:boolean; override; end; function GetFormStyle(var FormStyle:tFormStyle):boolean; procedure SetFormStyle(FormStyle:tFormStyle; Changed:boolean); implementation function GetFormStyle(var FormStyle:tFormStyle):boolean; begin Result:=FALSE; if Assigned(Application) then if Assigned(Application.MainForm) then begin FormStyle:=Application.MainForm.FormStyle; if (FormStyle=fsStayOnTop) and (Application.MainForm.WindowState<>wsMinimized) and Application.MainForm.Visible then begin Application.MainForm.FormStyle:=fsNormal; Result:=TRUE; end; end; end; procedure SetFormStyle(FormStyle:tFormStyle; Changed:boolean); begin if Changed and Assigned(Application) and Assigned(Application.MainForm) then begin Application.MainForm.FormStyle:=FormStyle; end; end; function TSaveDialog.Execute:boolean; var OldFormStyle:tFormStyle; Changed:boolean; begin Changed:=GetFormStyle(OldFormStyle); Result:=Inherited Execute; SetFormStyle(OldFormStyle, Changed); end; function TOpenDialog.Execute:boolean; var OldFormStyle:tFormStyle; Changed:boolean; begin Changed:=GetFormStyle(OldFormStyle); Result:=Inherited Execute; SetFormStyle(OldFormStyle, Changed); end; end.