Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Extract Tray And set its new Parent... (https://www.delphipraxis.net/136673-extract-tray-set-its-new-parent.html)

Razor 5. Jul 2009 19:42


Extract Tray And set its new Parent...
 
Hey!


Yes i found a new way to extract tray but i got a problem the background is kind of weird...(It updates fine and is full controlable);I figured this long ago but forgot..EnableBlurBehindWindow or Extendtoclient i used i dont konw but HELP!

Code:

Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
var
  wndMain, wndChild: HWND;
begin
  wndMain := FindWindow('Shell_TrayWnd','');
  if wndMain <> 0 then
  begin
    wndChild := FindWindowEx(wndMain, 0, 'TrayNotifyWnd', nil);
    wndChild := FindWindowEx(wndChild, 0, 'SysPager', nil);
    wndChild := FindWindowEx(wndChild, 0, 'ToolbarWindow32', nil);
    if wndChild <> 0 then
    begin
      ShowMessage('Window Handle: ' + IntToStr(wndChild));

      windows.SetParent(wndchild,form1.handle);
      EnableBlurBehindWindow(form1.Handle);

    end;
  end;

himitsu 5. Jul 2009 20:22

Re: Extract Tray And set its new Parent...
 
Although I have no solution for this, but before someone tried it!
...


Ich hab hierfür zwar keine Lösung, aber bevor es jemand ausprobiert!

Dieser Code klaut das TrayWindow aus der Taskleiste und demnach ist in der Taskleiste diesbezüglich nichts mehr bediehnbar.
Und noch schlimmer, wird das Programm beendet und das TrayWindow nicht zurückgegeben, dann wird dieses mit geschloßen.

Razor 5. Jul 2009 20:23

Re: Extract Tray And set its new Parent...
 
The only problem i have is the weird background then its ready to transplantation on a new taskbar...

turboPASCAL 5. Jul 2009 20:33

Re: Extract Tray And set its new Parent...
 
Ich habe das Nicht ausprobiert, da ich nicht daraus schlau geworden bin...
Aber mal fragen was Razor möchte darf man doch ?

Razor 5. Jul 2009 20:50

Re: Extract Tray And set its new Parent...
 
Zitat:

Zitat von himitsu
Although I have no solution for this, but before someone tried it!
...


Ich hab hierfür zwar keine Lösung, aber bevor es jemand ausprobiert!

Dieser Code klaut das TrayWindow aus der Taskleiste und demnach ist in der Taskleiste diesbezüglich nichts mehr bediehnbar.
Und noch schlimmer, wird das Programm beendet und das TrayWindow nicht zurückgegeben, dann wird dieses mit geschloßen.

No it WILL NOT be terminated becouse it will be a new taskbar..If you have a better idea how i should get system tray SPEAK UP! :x


Well yes i figured it out long time ago but i did use one of the functions to remove the background...

himitsu 5. Jul 2009 21:18

Re: Extract Tray And set its new Parent...
 
Create a new toolbar, which you can then sign themselves and clone the data from the other toolbar.

The background is painted by TrayNotifyWnd.
Log the messages to this window and see whether what the right thing is what you will still have to implement.


Before anyone tried the code above, then prefer to take this one, which the Toolbar is also released.
Bevor jemand den oberen Code ausprobiert, dann nehmt lieber diesen hier, welcher die Toolbar auch wieder freigibt.
Delphi-Quellcode:
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private-Deklarationen }
    _window, _parent: HWND;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  wndMain, wndChild: HWND;
begin
  wndMain := FindWindow('Shell_TrayWnd','');
  if wndMain <> 0 then
  begin
    wndChild := FindWindowEx(wndMain, 0, 'TrayNotifyWnd', nil);
    wndChild := FindWindowEx(wndChild, 0, 'SysPager', nil);
    wndChild := FindWindowEx(wndChild, 0, 'ToolbarWindow32', nil);
    if wndChild <> 0 then
    begin
      ShowMessage('Window Handle: ' + IntToStr(wndChild));
      _window := wndchild;
      _parent := windows.GetParent(_window);
      windows.SetParent(wndchild, form1.handle);
      //EnableBlurBehindWindow(form1.Handle);

    end;
  end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  windows.SetParent(_window, _parent);
end;

Razor 6. Jul 2009 11:02

Re: Extract Tray And set its new Parent...
 
Liste der Anhänge anzeigen (Anzahl: 1)
Well the only problem is background...


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:49 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz