Windows BlockInput功能不工作

Windows BlockInput function is not working

本文关键字:工作 功能 BlockInput Windows      更新时间:2023-10-16

为什么BlockInput不工作

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

而且它根本不会阻塞任何东西
我仍然可以做任何事情,就像我还没有做过一样
我还觉得奇怪的是MSDN说它应该在winuser.h中声明,而它在Winable.h+中。我以为winable.hwindows.h中,但事实并非如此,我不得不单独包含它>_>

如果它对我的IDE有帮助的话:
代码::块10.05 MinGW

编辑:实际上我做了GetLastError(),它打印错误5 ERROR_ACCESS_DENIED
我如何获得访问权限?

以管理员身份运行代码。右键单击可执行文件,然后单击"以管理员身份运行"。