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 Systemtray ersetzen (https://www.delphipraxis.net/21815-systemtray-ersetzen.html)

helen 8. Mai 2004 17:23


Systemtray ersetzen
 
Hallo,

ich suche eine Möglichkeit, die Symbole im Systemtray in einer eigenen Anwendung anzeigen zu lassen.

Das Ziel der ganzen Aktion:
Ich möchte statt des Windows - Explorers eine eigene Anwendung als Desktopumgebung einsetzen. Wenn ich nun aber in der Registry die entsprechenden Einträge ändere und meine Anwendung gestartet wird fliegen alle Fenster von Norton,... die sonst im Tray verschwanden auf dem Desktop herum.

Ich suche nach einer Möglichkeit, auf die funktion Shell_NotifyIcon reagieren zu können. Was mir dazu einfällt wäre ein Hook auf diese Funktion. Ich habe allerdings keine Ahnung wie das geht.

Bin für jede Idee, jeden Denkanstoß, Lösungsansatz, ... dankbar.

gruß Helen

toms 8. Mai 2004 17:26

Re: Systemtray ersetzen
 
Hi,

Auf www.madshi.net findest du alles was du brauchst.

c113plpbr 8. Mai 2004 18:46

Re: Systemtray ersetzen
 
Ich möchte nicht kleinlich sein, aber das wort 'Tray' ist ne art missverständniss ... soweit ich das weis heißt das ganze TaskBar Notification Area kurz TBNA ... :lol:
PS: Nimms nicht persönlich ;)

ciao, Philipp

helen 8. Mai 2004 20:53

Re: Systemtray ersetzen
 
Ich habe folgende Sourcen gebastelt, aber nix passiert:

Hook - dll

Code:
library TBNAhook;

uses
  Windows,
  madRemote,
  madCodeHook,
  madStrings,
  ShellAPI,
  dialogs;

var Shell_NotifyIcon : function (dwMessage: DWORD; lpData: PNotifyIconData) : bool; stdcall;
var Shell_NotifyIconA : function (dwMessage: DWORD; lpData: PNotifyIconData) : bool; stdcall;
var Shell_NotifyIconW : function (dwMessage: DWORD; lpData: PNotifyIconData) : bool; stdcall;


function MY_NotifyIcon (dwMessage: DWORD; lpData: PNotifyIconData): BOOL; stdcall;
begin
  ShowMessage (lpData.szTip);

  result := true;
end;

function MY_NotifyIconA (dwMessage: DWORD; lpData: PNotifyIconData): BOOL; stdcall;
begin
  ShowMessage (lpData.szTip);

  result := true;
end;

function MY_NotifyIconW (dwMessage: DWORD; lpData: PNotifyIconData): BOOL; stdcall;
begin
  ShowMessage (lpData.szTip);

  result := true;
end;

begin
  HookAPI('shell32.dll', 'Shell_NotifyIcon', @MY_NotifyIcon, @Shell_NotifyIcon);
  HookAPI('shell32.dll', 'Shell_NotifyIconA', @MY_NotifyIconA, @Shell_NotifyIconA);
  HookAPI('shell32.dll', 'Shell_NotifyIconW', @MY_NotifyIconW, @Shell_NotifyIconW);
end.
Programm unit
Code:
unit Testmain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, madCodeHook;

type
  TForm1 = class(TForm)
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

begin
  InjectLibrary(ALL_SESSIONS or SYSTEM_PROCESSES, 'TBNAhook.dll');

  UninjectLibrary(ALL_SESSIONS or SYSTEM_PROCESSES, 'TBNAhook.dll');
end.

Wo steckt der Fehler?

helen 11. Mai 2004 21:02

Re: Systemtray ersetzen
 
Ich habe es jetzt mit ein wenig Bastelei geschafft, das die Orginalfunktion durch meine eigene ersetzt wird.

Wie kann ich nun auf die Daten, die im Object PNotifyIconData gespeichert sind zugreifen, und das Bild und die Ballontipps, etc in meiner Anwendung darstellen?

MathiasSimmack 11. Mai 2004 21:31

Re: Systemtray ersetzen
 
Wenn´s nicht in der Art funktioniert wie hier
Zitat:

Zitat von helen
Delphi-Quellcode:
ShowMessage (lpData.szTip);

bzw.
Delphi-Quellcode:
PNotifyIconData(lpData)^.szTip
o.ä. (denn PNotifyIconData ist ja IMHO nur ein Zeiger auf das TNotifyIconData-Record), dann ist es wohl doch komplizierter als du denkst. Und die Balloon-Tipps müsstest du wohl selbst darstellen, denn a) setzen die eine bestimmte "shell32.dll"-Version voraus (5.0 aufwärts), und b) möchtest du ja nichts vom System nutzen.

helen 13. Mai 2004 12:28

Re: Systemtray ersetzen
 
In meinem letzten Beitrag habe ich mich blöd ausgedrückt... I'm sorry!

Ich habe eine Anwendung Leiste, die ein Formular Form1 anzeigt. Die Hook.dll wurde nun korrekt eingerichtet, und die in dieser dll enthaltene funktion Shell_NotifyIcon soll jetzt das Icon, welches ihr übergeben wurde auf dem TPanel Panel1 auf dem Formular Form1 der Anwendung Leiste ablegen.

Wie bekomme ich dies hin?


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:33 Uhr.

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