Ver Mensaje Individual
  #9  
Antiguo 21-10-2010
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.210
Reputación: 22
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Efectivamente, el sistema de capturar HotsKeys en Win 7 no funciona con ALT+TAB. Pero si funciona un Hook al teclado como el de este ejemplo que he preparado:

Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  WHookKeyboard: cardinal;

implementation

{$R *.dfm}
function KeyboardHook(Code, wParam, lParam: Integer): Integer; stdcall;
begin
  if (Code = HC_ACTION) and LongBool(PDWORD(lParam + 8)^ and $20{LLKHF_ALTDOWN}) and (PDWORD(lParam)^ = VK_TAB) then
  begin
      Beep();
  end;
  Result:= CallNextHookEx(WHookKeyboard, Code, wParam, lParam);
end;



procedure TForm1.FormCreate(Sender: TObject);
begin
 WHookKeyboard:= SetWindowsHookEx(13{WH_KEYBOARD_LL}, @KeyboardHook, HInstance, 0);

end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  UnhookWindowsHookEx(WHookKeyboard);
end;

end.

Saludos.
Responder Con Cita