I'm attempting to setup a system whereby a hotkey can be used to enable/disable a set of hooks to block mouse input and most all keyboard input from reaching the system. (so that a tablet can be safely holstered)
However, I've determined that even if you have your global hook dll with it's HHOOK variables in a shared data segment that:
1) If application A enables them via the dll and then exits that they are then disabled at exit.
2) If application B loads the dll and sits there not exiting, then the same behavior is still seen when application A runs and exits.
3) If application B loads the dll and sets them and then sits there not exiting. Then application A can disable them, exit, and have the state change persist. However, it can't then reset and have the hook persist past exit.
So my question is, how do I go about having a temporary instance of an app enable persistent hooks? At this point I'm guessing I either need to figure out how to setup a service that loads the dll and waits for my temporary app to tell it to enable/disable or I need to have the dll loaded by a program I know will be running, and then setup an IPC method to tell it to enable/disable. Or is there a relatively simple way to tell windows to allow the hooks to persist past program exit?
However, I've determined that even if you have your global hook dll with it's HHOOK variables in a shared data segment that:
1) If application A enables them via the dll and then exits that they are then disabled at exit.
2) If application B loads the dll and sits there not exiting, then the same behavior is still seen when application A runs and exits.
3) If application B loads the dll and sets them and then sits there not exiting. Then application A can disable them, exit, and have the state change persist. However, it can't then reset and have the hook persist past exit.
So my question is, how do I go about having a temporary instance of an app enable persistent hooks? At this point I'm guessing I either need to figure out how to setup a service that loads the dll and waits for my temporary app to tell it to enable/disable or I need to have the dll loaded by a program I know will be running, and then setup an IPC method to tell it to enable/disable. Or is there a relatively simple way to tell windows to allow the hooks to persist past program exit?