Link to home
Start Free TrialLog in
Avatar of kidspc
kidspc

asked on

BlockInput not working on Windows 7

Hi

I have a program in VB6 that use the BlockInput API, however on Windows 7 , that api doesn't work. I have searched on google and i found that.

But no solution is provided, do you have an alternate api to block the keyboard and mouse on Windows 7 ?

thank you very much !
Mariano.
ASKER CERTIFIED SOLUTION
Avatar of HawyLem
HawyLem

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kidspc
kidspc

ASKER

we have done that, give administrative privileges to the accounts and nothing, we also used the Adminitrator account and didn't work
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.
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).

Is any of these your case?
Try turning UAC off, for testing purposes only, and  see if your program works then turn UAC back on
Avatar of kidspc

ASKER

@HawyLem, no those are not our case.  We just try to block the computer and the api is called without the result we expect, only on Windows 7.  If we try to do that on XP, 98 or Vista it works perfectly.
Return Value

Type: BOOL

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.

Please check the return value to realize if the function has succeeded. Otherwise check the error
Avatar of kidspc

ASKER


thanks all of you for your opinions to resolve this.

HawyLem,  your last message give us a clue about what was wrong.  Your first answer was right, however due to some "if" the code was not runing to the BlockInput API.

So, thanks again for your help, i give the points to HawyLem.
Avatar of kidspc

ASKER

in the way to check the return value of BlockInput API we discover why the function was not called