Thread: BlockInput(true) help

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    17

    BlockInput(true) help

    Hi guys,

    Im having trouble working the BlockInput(); command.

    Here is my code:

    Code:
    #include <windows.h>
    #include <winable.h>
    #include <stdio.h>
    
    using namespace std;
    
    int main(){
        Sleep(1000);
        BlockInput(true);
        Sleep(5000);
        BlockInput(false);
        
        return 0;
    }
    It compiles and runs fine, but it will not block the mouse or keyboard.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Mmkay. What do you imagine that we can deduce from this trouble report that can help you?

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I'm not entirely sure why you think it's not working -- what does the program do, after all? -- but I can say this: just for fun, I compiled this with codeblocks, which does a press any key... bit after the program ends. Keys I pressed right away did close the window, but if I waited a couple of seconds, those keys were ignored. Make of that what you will.

  4. #4
    Registered User
    Join Date
    Jul 2008
    Posts
    17
    It does everything but block the mouse or keyboard input i can still use both while it is running

  5. #5
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Lemme guess. You want it to block everything for every application?

  6. #6
    Registered User
    Join Date
    Jul 2008
    Posts
    17
    yes.

    You can tell that im a newbie, so if you want to take the p........ then you can do.

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Code:
    cout << "Smash your keyboard and mouse with a hammer.\n"
    As my example showed (at least in my mind), BlockInput is blocking keyboard input, but only for that program.

  8. #8
    Registered User
    Join Date
    Jul 2008
    Posts
    17
    ok then.

    Thanks tho

Popular pages Recent additions subscribe to a feed