(Gast)
n/a Beiträge
|
Re: Formfenster soll wenn es inaktiv ist auf eingabe reagier
4. Okt 2006, 22:16
Hier damit du siehst auf was du dich da einläßt!
Delphi-Quellcode:
library HookDLL;
uses
Windows,
Messages,
SysUtils,
Classes;
{$R *.res}
var
G_hHook : THandle;
//------------------------------------------------------------------------------
function MessageHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
var
aMsg: ^tagMSG;
aCDS: TCopyDataStruct;
hWnd: THandle;
begin
if (nCode < 0) then
Result := CallNextHookEx(G_hHook, nCode, wParam, lParam)
else
begin
aMsg := pointer(lParam);
aCDS.dwData := 0;
aCDS.cbData := SizeOf(tagMsg);
aCDS.lpData := aMsg;
if aMsg^.message = WM_MOUSEWHEEL then // !!!
begin
hWnd := FindWindow(nil, 'Form1');
SendMessage(hWnd, WM_COPYDATA, 0, integer(@aCDS));
end;
if aMsg^.message = WM_LBUTTONDBLCLK then // !!!
begin
hWnd := FindWindow(nil, 'Form1');
SendMessage(hWnd, WM_COPYDATA, 0, integer(@aCDS));
end;
Result := CallNextHookEx(G_hHook, nCode, wParam, lParam);
end;
end;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function InstallHook(DWThreadID: DWORD): boolean; stdcall;
begin
Result := False;
if (G_hHook <> 0) then
begin
MessageBox(0, 'Hook already installed!', '', 0);
Exit;
end;
G_hHook := SetWindowsHookEx(WH_GETMESSAGE, @MessageHookProc, GetModuleHandle('HookDLL.dll'), DWThreadID);
Result := G_hHook <> 0;
if Result then
MessageBox(0, 'Hook successfully installed.', 'InstallHook', MB_ICONINFORMATION);
end;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
procedure UnInstallHook; stdcall;
begin
if (G_hHook <> 0) then
UnhookWindowsHookEx(G_hHook);
end;
//------------------------------------------------------------------------------
exports
InstallHook,
UnInstallHook;
begin
G_hHook := 0;
end.
Mußt du halt selber umstricken auf Tastatur Befehle.
Gruß
|
|
Zitat
|