Ver Mensaje Individual
  #2  
Antiguo 21-11-2012
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.211
Reputación: 22
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
No existen los mensajes WM_LBUTTONDBLCLK y WM_RBUTTONDBLCLK para un Hook de ratón, por eso no te funciona. Deberás medir el tiempo entre dos clicks sucesivos para saber si se trata de un doble click quedaría de esta forma:

Código Delphi [-]
unit Hooks;


interface
procedure SetHook;
procedure ReleaseHook;

function clock: integer; cdecl; external 'msvcrt.dll';

implementation
uses Windows, Messages;
const
  WH_MOUSE_LL = 14;
var
  Hook: HHook;


function DBLClick_Detect: boolean;
const
{$J+}
  start: integer = 0;
var
  dif: integer;
begin
  Result:= false;
  if start = 0 then start:= clock();
  dif:= clock() - start;
  if (dif < GetDoubleClickTime) and (dif > 3) then Result:= true;
  start:= clock();
{$J-}
end;

function MouseProc(Code: Integer; WParam, LParam: DWORD): HHook; stdcall;
begin
  if Code = HC_ACTION then
  begin
    if (WParam = WM_LBUTTONDOWN) or (WParam = WM_RBUTTONDOWN) then
    begin
      if DBLClick_Detect then
      begin
        Result:= 1;
        Exit;
      end;
    end;
  end;
  Result := CallNextHookEx(Hook, Code, WParam, LParam);
end;

procedure SetHook;
begin
  Hook := SetWindowsHookEx(WH_MOUSE_LL, @MouseProc, HInstance, 0);
end;
procedure ReleaseHook;
begin
  if Hook <> 0 then UnhookWindowsHookEx(Hook);
end;

initialization
  Hook := 0;

finalization
  ReleaseHook;

end.


Saludos.

Última edición por escafandra fecha: 21-11-2012 a las 02:44:26.
Responder Con Cita