mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 09:38:13 +02:00
win32: fix TWin32WSCustomForm.SetShowInTaskbar for the case when window is visible
git-svn-id: trunk@20710 -
This commit is contained in:
parent
cc9bb3ed6e
commit
7a0a4d2038
@ -424,18 +424,33 @@ class procedure TWin32WSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
|
||||
const AValue: TShowInTaskbar);
|
||||
var
|
||||
Style: DWord;
|
||||
Visible, Active: Boolean;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(AForm, 'SetShowInTaskbar') then
|
||||
Exit;
|
||||
if (Application <> nil) and (AForm = Application.MainForm) then
|
||||
Exit;
|
||||
|
||||
// to apply this changes we need either to hide window or recreate it. Hide is
|
||||
// less difficult
|
||||
Visible := IsWindowVisible(AForm.Handle);
|
||||
Active := GetForegroundWindow = AForm.Handle;
|
||||
if Visible then
|
||||
ShowWindow(AForm.Handle, SW_HIDE);
|
||||
|
||||
Style := GetWindowLong(AForm.Handle, GWL_EXSTYLE);
|
||||
if AValue = stAlways then
|
||||
Style := Style or WS_EX_APPWINDOW
|
||||
else
|
||||
Style := Style and not WS_EX_APPWINDOW;
|
||||
SetWindowLong(AForm.Handle, GWL_EXSTYLE, Style);
|
||||
|
||||
// now we need to restore window visibility with saving focus
|
||||
if Visible then
|
||||
if Active then
|
||||
ShowWindow(AForm.Handle, SW_SHOW)
|
||||
else
|
||||
ShowWindow(AForm.Handle, SW_SHOWNA);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomForm.ShowModal(const ACustomForm: TCustomForm);
|
||||
|
Loading…
Reference in New Issue
Block a user