mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-04 04:00:25 +02:00
win32 intf: TWin32WSCustomForm.SetShowInTaskbar check if something changes
git-svn-id: trunk@24751 -
This commit is contained in:
parent
81a5b44f7b
commit
5ee092816e
@ -458,7 +458,7 @@ end;
|
||||
class procedure TWin32WSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
|
||||
const AValue: TShowInTaskbar);
|
||||
var
|
||||
Style: DWord;
|
||||
OldStyle, NewStyle: DWord;
|
||||
Visible, Active: Boolean;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(AForm, 'SetShowInTaskbar') then
|
||||
@ -466,6 +466,14 @@ begin
|
||||
if (Application <> nil) and (AForm = Application.MainForm) then
|
||||
Exit;
|
||||
|
||||
OldStyle := GetWindowLong(AForm.Handle, GWL_EXSTYLE);
|
||||
NewStyle := OldStyle;
|
||||
if AValue = stAlways then
|
||||
NewStyle := NewStyle or WS_EX_APPWINDOW
|
||||
else
|
||||
NewStyle := NewStyle and not WS_EX_APPWINDOW;
|
||||
if OldStyle=NewStyle then exit;
|
||||
|
||||
// to apply this changes we need either to hide window or recreate it. Hide is
|
||||
// less difficult
|
||||
Visible := IsWindowVisible(AForm.Handle);
|
||||
@ -473,12 +481,7 @@ begin
|
||||
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);
|
||||
SetWindowLong(AForm.Handle, GWL_EXSTYLE, NewStyle);
|
||||
|
||||
// now we need to restore window visibility with saving focus
|
||||
if Visible then
|
||||
|
Loading…
Reference in New Issue
Block a user