![]() |
uallcollection hook
Hi,
ich versuche mich gerade zum erstenmal an einem hook. Hierfür benutzte ich die uallcollection. Mein code sieht momentan so aus:
Delphi-Quellcode:
Dieser funktioniert soweit auch ganz toll, ich bekomm die messagebox angezeigt mit den werten etc. jedoch bekomm ich nach der markierten zeile(sprich nachdem die messagebox weggeklickt wurde) eine AV.
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, uallHook; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; var origMoveWindow: procedure (x: UINT;y: UINT; nWidth: UINT;nHeight: UINT;bRepaint: boolean); stdcall; newMoveWindow: procedure (x: UINT;y: UINT; nWidth: UINT;nHeight: UINT;bRepaint: boolean); stdcall; implementation {$R *.dfm} procedure callback(x: UINT;y: UINT; nWidth: UINT;nHeight: UINT;bRepaint: boolean); stdcall; begin ShowMessage(IntToStr(x)+'|'+IntToStr(y)+'|'+IntToStr(nWidth)+'|'+IntToStr(nHeight)); end; procedure TForm1.Button1Click(Sender: TObject); begin @origMoveWindow:=GetProcAddress(LoadLibrary('user32.dll'),'MoveWindow'); uallHook.HookCode(@origMoveWindow,@callback,@newMoveWindow); MoveWindow(self.Handle,1,1,500,500,true); //hier uallHook.UnhookCode(@newMoveWindow); end; end. Was mach ich falsch? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:32 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