Thema: Delphi Systemtray ersetzen

Einzelnen Beitrag anzeigen

helen

Registriert seit: 8. Mai 2004
42 Beiträge
 
#4

Re: Systemtray ersetzen

  Alt 8. Mai 2004, 21:53
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?
  Mit Zitat antworten Zitat