我在程序中使用了REALAUDIO控件,播放一个电影全屏之后,任何按键信息我的程序都捕捉不到,应如何解决?

解决方案 »

  1.   

    方法很多的,可以Hook,From 超级猛料
    ----------------------按键地勾子以下是一个按键地勾子:Intercepting The TAB and ENTER Keys {the prototype for the new keyboard hook function}  function KeyboardHook(nCode: Integer; wParam: WPARAM;                        lParam: LPARAM): LResult; stdcall; var  Form1: TForm1;  WinHook: HHOOK;    // a handle to the keyboard hook function implementation {$R *.DFM} procedure TForm1.FormCreate(Sender: TObject);begin   {install the keyboard hook function into the keyboard hook chain}  WinHook:=SetWindowsHookEx(WH_KEYBOARD, @KeyboardHook, 0, GetCurrentThreadID);end; procedure TForm1.FormDestroy(Sender: TObject);begin  {remove the keyboard hook function from the keyboard hook chain}  UnhookWindowsHookEx(WinHook);end; function KeyboardHook(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LResult; begin  {if we can process the hook information...}  if (nCode>-1) then    {...was the TAB key pressed?}    if (wParam=VK_TAB) then    begin      {if so, output a beep sound}      MessageBeep(0);       {indicate that the message was processed}      Result := 1;    end    else    {...was the RETURN key pressed?}     if (wParam=VK_RETURN) then    begin      {if so, and if the key is on the up stroke, cause      the focus to move to the next control}      if ((lParam shr 31)=1) then        Form1.Perform(WM_NEXTDLGCTL, 0, 0);       {indicate that the message was processed}      Result := 1;    end    else      {otherwise, indicate that the message was not processed.}       Result := 0  else    {we must pass the hook information to the next hook in the chain}    Result := CallNextHookEx(WinHook, nCode, wParam, lParam);end; 满意吗?分可别忘了!
      

  2.   

    忘了说,不要HOOK。
    HOOK的话我早就实现了。
      

  3.   

    另外你的代码根本没有任何效果。
    HOOK的处理过程必须放在另外一个DLL中,但你没放。
      

  4.   

    //HOOK的处理过程必须放在另外一个DLL中,但你没放。看这句:
    WinHook:=SetWindowsHookEx(WH_KEYBOARD, @KeyboardHook, 0, GetCurrentThreadID);这说明budded(All By Myself)用的钩子不是全局钩子,所以不需要额外的dll
    另外,即使用全局钩子的话,也不一定都需要额外的dll,比如说WH_KEYBOARD_LL钩子,你可以考虑挂接这个钩子解决你的问题,另外,你也可以考虑注册热键解决你的问题
      

  5.   

    TO:暴风雨V20
    我试过,HOOK子程序会被执行,但无法得到键值(WPARM是固定不变的)
    热键也不行。
      

  6.   

    用  RegisterHotKey(handle,0,MOD_CONTROL,ord('S'))注册的热键,
    为何没有效果?
    //检测哪个键按下了
      case msg.HotKey of
        0:ShowMessage('Ctrl+Alt+R键被按下!');
      end;
    。这里子程不会执行。