Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows BlockInput function is not working

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?

like image 231
SmRndGuy Avatar asked Oct 24 '25 22:10

SmRndGuy


1 Answers

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

like image 77
David Schwartz Avatar answered Oct 27 '25 13:10

David Schwartz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!