BlockInput() fails

closed account (DGvMDjzh)
I found a neat windows function called BlockInput(), it's supposed to block your mouse/keyboard controls globally.

1
2
3
4
5
6
7
8
9
#include <windows.h>
#include <winable.h>
#include <time.h>

int main() {
 BlockInput(true);
 while (clock() < 5000) {}
 BlockInput(false);
}


Unfortunately BlockInput(true) returns 0 which indicates that there's some sort of error. Any ideas what it could be? I use Windows 7.
Last edited on
from msdn:
If input is already blocked, the return value is zero. To get extended error information, call GetLastError.


Calling GetLastError will give you info on what is causing the error.
closed account (DGvMDjzh)
Thanks for the response. It appears that access to the function was denied because I didn't run the program as an administrator.
Topic archived. No new replies allowed.