Windows BlockInput function is not working

2019-05-25 06:55发布

Why BlockInput isn't working

#include <iostream>
#include <windows.h>
#include <winable.h>
int main() {
    BlockInput(true);
    Sleep(10000);
    return 0;
}

and it simply doesn't block anything!
I can still do everything like I haven't even done that.
what I also find weird is that MSDN sais that it should be declared in winuser.h and it is in Winable.h + I thought that winable.h is in windows.h but It's not, I had to include it seperatly >_>

If it helps my IDE is:
Code::Blocks 10.05 MinGW

EDIT: Actually I did the GetLastError() and it prints error 5 ERROR_ACCESS_DENIED
How may I get the access?

1条回答
等我变得足够好
2楼-- · 2019-05-25 07:02

Run your code as an administrator. Right-click on the executable and click 'run as Administrator'.

查看更多
登录 后发表回答