win32: don't create a taskbar item for LCL in libraries based on patch of Christian Budde (issue #0017965)

git-svn-id: trunk@28859 -
This commit is contained in:
paul 2011-01-04 07:33:34 +00:00
parent cb6d78faba
commit 2c06e838e4

View File

@ -146,6 +146,8 @@ begin
end;
// Create parent of all windows, 'button on taskbar'
if not IsLibrary then
begin
{$ifdef WindowsUnicodeSupport}
if UnicodeEnabledOS then
FAppHandle := CreateWindowW(@ClsNameW,
@ -177,6 +179,7 @@ begin
Windows.DeleteMenu(SysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
Windows.DeleteMenu(SysMenu, SC_SIZE, MF_BYCOMMAND);
Windows.DeleteMenu(SysMenu, SC_MOVE, MF_BYCOMMAND);
end;
// initialize ScreenInfo
Handle := GetDesktopWindow;
@ -201,6 +204,7 @@ end;
------------------------------------------------------------------------------}
procedure TWin32WidgetSet.AppMinimize;
begin
if FAppHandle <> 0 then
Windows.SendMessage(FAppHandle, WM_SYSCOMMAND, SC_MINIMIZE, 0);
end;
@ -213,6 +217,7 @@ end;
------------------------------------------------------------------------------}
procedure TWin32WidgetSet.AppRestore;
begin
if FAppHandle <> 0 then
Windows.SendMessage(FAppHandle, WM_SYSCOMMAND, SC_RESTORE, 0);
end;
@ -226,6 +231,7 @@ end;
------------------------------------------------------------------------------}
procedure TWin32WidgetSet.AppBringToFront;
begin
if FAppHandle <> 0 then
Windows.SetForegroundWindow(FAppHandle);
end;
@ -477,42 +483,53 @@ end;
procedure TWin32WidgetSet.AppSetIcon(const Small, Big: HICON);
begin
Windows.SendMessage(Win32Widgetset.AppHandle, WM_SETICON, ICON_SMALL, LPARAM(Small));
SetClassLong(Win32Widgetset.AppHandle, GCL_HICONSM, LONG(Small));
if FAppHandle <> 0 then
begin
Windows.SendMessage(FAppHandle, WM_SETICON, ICON_SMALL, LPARAM(Small));
SetClassLong(FAppHandle, GCL_HICONSM, LONG(Small));
Windows.SendMessage(Win32Widgetset.AppHandle, WM_SETICON, ICON_BIG, LPARAM(Big));
SetClassLong(Win32Widgetset.AppHandle, GCL_HICON, LONG(Big));
Windows.SendMessage(FAppHandle, WM_SETICON, ICON_BIG, LPARAM(Big));
SetClassLong(FAppHandle, GCL_HICON, LONG(Big));
end;
end;
procedure TWin32WidgetSet.AppSetTitle(const ATitle: string);
begin
if FAppHandle <> 0 then
begin
{$ifdef WindowsUnicodeSupport}
if UnicodeEnabledOS then
begin
Windows.SetWindowTextW(FAppHandle, PWideChar(UTF8ToUTF16(ATitle)));
end else Windows.SetWindowText(FAppHandle, PChar(Utf8ToAnsi(ATitle)));
Windows.SetWindowTextW(FAppHandle, PWideChar(UTF8ToUTF16(ATitle)))
else
Windows.SetWindowText(FAppHandle, PChar(Utf8ToAnsi(ATitle)));
{$else}
Windows.SetWindowText(FAppHandle, PChar(ATitle));
{$endif}
end;
end;
procedure TWin32WidgetSet.AppSetVisible(const AVisible: Boolean);
begin
if FAppHandle <> 0 then
begin
if AVisible then
Windows.ShowWindow(FAppHandle, SW_SHOW)
else
Windows.ShowWindow(FAppHandle, SW_HIDE);
end;
end;
function TWin32WidgetSet.AppRemoveStayOnTopFlags(const ASystemTopAlso: Boolean = False): Boolean;
begin
RemoveStayOnTopFlags(AppHandle, ASystemTopAlso);
if not IsLibrary then
RemoveStayOnTopFlags(FAppHandle, ASystemTopAlso);
Result := True;
end;
function TWin32WidgetSet.AppRestoreStayOnTopFlags(const ASystemTopAlso: Boolean = False): Boolean;
begin
RestoreStayOnTopFlags(AppHandle);
if not IsLibrary then
RestoreStayOnTopFlags(FAppHandle);
Result := True;
end;
@ -592,7 +609,8 @@ end;
procedure TWin32WidgetSet.HandleWakeMainThread(Sender: TObject);
begin
// wake up GUI thread by sending a message to it
Windows.PostMessage(AppHandle, WM_NULL, 0, 0);
if FAppHandle <> 0 then
Windows.PostMessage(FAppHandle, WM_NULL, 0, 0);
end;
{ Private methods (in no significant order) }