如何分别屏蔽键盘,鼠标?

解决方案 »

  1.   

    要用hook来抓住所有键盘,鼠标的消息
      

  2.   

    to stiwin:请说得详细点
    有没有例子!我也想了解了解!!
      

  3.   

    to stiwin:请说得详细点,我还是个初学者,谢!
      

  4.   

    为什么要分别屏蔽?
    The BlockInput function blocks keyboard and mouse input events from reaching applications. BOOL BlockInput(
      BOOL fBlockIt  // block option
    );
    Parmeters
    fBlockIt 
    [in] Specifies the function's purpose. If this parameter is TRUE, keyboard and mouse input events are blocked. If this parameter is FALSE, keyboard and mouse events are unblocked. Note that only the thread that blocked input can successfully unblock input. 
    Return Values
    If the function succeeds, the return value is nonzero.If input is already blocked, the return value is zero. To get extended error information, call GetLastError. Res
    When input is blocked, real physical input from the mouse or keyboard will not affect the the input queue's synchronous key state (reported by GetKeyState and GetKeyboardState), nor will it affect the asynchronous key state (reported by GetAsyncKeyState). However, the thread that is blocking input can affect both of these key states by calling SendInput. No other thread can do this.The system will unblock input in the following cases: The thread that blocked input unexpectedly exits without calling BlockInput with fBlock set to FALSE. In this case, the system cleans up properly and re-enables input. 
    Windows 95/98/Me: The system displays the Close Program/Fault dialog box. This can occur if the thread faults or if the user presses CTRL+ALT+DEL. 
    Windows 2000 or later: The user presses CTRL+ALT+DEL or the system invokes the Hard System Error modal message box (for example, when a program faults or a device fails). 
    Requirements 
      Windows NT/2000 or later: Requires Windows 2000 or later.
      Windows 95/98/Me: Requires Windows 98 or later.
      Header: Declared in Winable.h.
      Library: Use User32.lib.