//Source in Hook-DLL
{...}
type
THookMap =
record
aHandle: integer;
BlockMouse: boolean;
end;
var
HookHandle : HHook;
FileMapObj : THandle;
FileMapView : ^THookMap;
function MouseHookProc(Code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT;
stdcall;
var
BlockM: boolean;
begin
if code = HC_ACTION
then
begin
FileMapObj := OpenFileMapping(FILE_MAP_READ, true,'
MouseHookMapFile');
if FileMapObj <> 0
then
begin
FileMapView := MapViewOfFile(FileMapObj, FILE_MAP_READ, 0, 0, 0);
PostMessage(FileMapView^.aHandle, WM_HOOKMAP, wParam, lParam);
//hier stimmt noch alles
BlockM := FileMapView^.BlockMouse;
UnmapViewOfFile(FileMapView);
CloseHandle(FileMapObj);
end;
{if wParam <> WM_MOUSEMOVE then
;}
if BlockM
then //Hier allerdings nicht mehr. Erst wenn die noch auskommentierten Zeilen nicht mehr auskommentiert sind, wird der Wert von BlockM richtig erkannt.
Result := CallNextHookEx(HookHandle, Code, WParam, LParam);
end;
end;
{...}
//Source in Programm
{...}
FileMapObj := CreateFileMapping( INVALID_HANDLE_VALUE,
nil, PAGE_READWRITE, 0, SizeOf(THookMap), '
MouseHookMapFile');
if FileMapObj = 0
then
raise Exception.Create( '
Error while creating file.');
FileMapView := MapViewOfFile(FileMapObj, FILE_MAP_WRITE, 0, 0, 0);
FileMapView^.aHandle :=
Handle;
FileMapView^.BlockMouse := false;
{...}