Einzelnen Beitrag anzeigen

neolithos

Registriert seit: 31. Jul 2003
Ort: Dresden
1.386 Beiträge
 
Delphi 7 Architect
 
#21

Re: Problem mit Nachricht aus DLL

  Alt 7. Jul 2004, 13:04
Meine Mouse-Hook:

Delphi-Quellcode:
  PHookData = ^THookData;
  THookData = packed record
    hk,
    hWnd,
    wmNotify : Cardinal;
  end;
Delphi-Quellcode:
function MouseHook(iCode : Integer; dwMsg : Cardinal; pMouseData : PMouseHookStruct) : Integer;
var pData : PHookData;
    hMap : Cardinal;
    pt : TSmallPoint;
begin
  hMap := OpenFileMapping(FILE_MAP_ALL_ACCESS, false, csFileMappingMouse);
  if hMap = 0 then
     Result := 0
  else
     begin
       pData := MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);

       if (iCode = HC_ACTION) then
          if pData^.hWnd <> 0 then
             begin
               pt := PointToSmallPoint(pMouseData^.pt);
               PostMessage(pData^.hWnd, pData^.wmNotify, dwMsg, PCardinal(@pt)^);
             end;

       Result := CallNextHookEx(pData^.hk, iCode, dwMsg, Integer(pMouseData));
       UnmapViewOfFile(pData);
       CloseHandle(hMap);
     end;
end;
- ciao neo -
Es gibt niemals dumme Fragen, sondern nur dumme Antworten!
  Mit Zitat antworten Zitat