>>Hi!
>>
>>>I'm looking for the way to lock and unlock the keyboard from a form, but I didn't somebody knows how do it ?
>>
>>Try this:
>>
Declare Integer BlockInput in Win32API Integer
>>BlockInput(.T.)
>>It will block keyboard and mouse input. To unlock call BlockInput(.F.)
>>or press CTRL+ALT+DEL.
>>
>>Alexander
>
>Would this block input for all applications, or only for the currently running application?
>
Hilmar,
The Platform SDK states that it block input from the keyboard and mouse for applications (plural). I take it that this means all applications. However, I couldn't recommend its use.
First, the platform must be Win98 or later.
Second, because keyboard and mouse input are blocked there's no way short of Ctrl+Alt+Del for the user to unblock input, so it must be done programmatically. Should an error occur and the application terminates, it is unblocked, but if the error handler does not shut down the application, it remains blocked.
Third, this kind of behavior runs contrary to the purposes of Windows itself which is a pre-emptive, multi-tasking, OS. IOW, the user should be able to interact with other applications.
All in all, I'd say that Cetin's advice is probably the way to go.
George
Ubi caritas et amor, deus ibi est