also ich bin jetzt auf dem Stand, das ich in der Hook-Funktion eine Message an meine Komponente schicken will.Nur leider kenne ich das
Handle der Komponente nicht.Könnt ihr mir bitte helfen?
Delphi-Quellcode:
unit HintCBx;
interface
uses
SysUtils, Classes, Controls, StdCtrls, Messages, Windows, Graphics, ExtCtrls;
const
WM_HINT = WM_USER + 1;
type
THintCBx =
class(TCheckBox)
private
{ Private-Deklarationen }
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
procedure WMHint(
var Message: TWMMouseMove);
message WM_HINT;
Constructor Create(AOwner:TComponent);
override;
Destructor Destroy;
override;
published
{ Published-Deklarationen }
end;
function MouseProc(nCode : Integer; wParam: WPARAM; lParam : LPARAM): LRESULT;
stdcall;
var
MouseHook : HHOOK;
{ ---------------------------------------------------------------------------- }
procedure Register;
{ ---------------------------------------------------------------------------- }
implementation
{ ---------------------------------------------------------------------------- }
procedure Register;
begin
RegisterComponents('
Beispiele', [THintCBx]);
end;
{ ---------------------------------------------------------------------------- }
{ THintCBx }
{ ---------------------------------------------------------------------------- }
function MouseProc(nCode : Integer; wParam: WPARAM; lParam : LPARAM): LRESULT;
stdcall;
begin
if (wParam = WM_MOUSEMOVE)
then
begin
if ControlHandle <> 0
then
begin
//SendMessage(ControlHandle,WM_MOUSEMOVE,wParam,lParam);
SendMessage(
HANDLE,WM_HINT,wParam,lParam);
end;
end;
Result := CallNextHookEx(MouseHook,nCode,wParam,lParam);
end;
{ ---------------------------------------------------------------------------- }
constructor THintCBx.Create(AOwner: TComponent);
begin
inherited;
MouseHook := SetWindowsHookEx(WH_MOUSE, @MouseProc, 0, GetCurrentThreadId());
end;
{ ---------------------------------------------------------------------------- }
destructor THintCBx.Destroy;
begin
if MouseHook <> 0
then
UnhookWindowsHookEx(MouseHook);
inherited;
end;
In WM_HINT erfolgt dann meine Auswertung...
Nur ich brauche das Komponenten-
Handle für SendMessage?!
Hoffe ihr könnt mir helfen
MFG Alex