| | |
Question?
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
No. A window must be visibe to be active (i.e. in order to receive user input events).
Even though the window is inactive, your application is still running though, and can receive other events.
You can set a system hook to capture events you are interested in, using SetWindowsHookEx(). System-wide event hooks usually require a DLL.
Hope this helps.
Even though the window is inactive, your application is still running though, and can receive other events.
You can set a system hook to capture events you are interested in, using SetWindowsHookEx(). System-wide event hooks usually require a DLL.
Hope this helps.
•
•
Join Date: Nov 2007
Posts: 290
Reputation:
Solved Threads: 7
•
•
•
•
You'll have to look at the documentation for SetWindowsHookEx(). The hook type you want is WH_KEYBOARD, if you intend it intercept and maybe change the keyboard input, or WH_JOURNALRECORD just to monitor it.
You can google all of this over at MSDN.
Good luck.
And SetWindowsHookEx() is Windows 95/98/Me function.
Only i can use WH_KEYBOARD_LL and CallNextHookEx() but how without setwindowshookex() .
Last edited by kv79; Dec 17th, 2007 at 7:00 am.
Listen, I'm not making this stuff up.
Here's the official Microsoft Documentation.
At the end of the page here it says that you need at least Windows 95 or NT 3.1 (both the basic Win32 platforms). I've used hook procedures on XP, and they are still valid in Vista.
If you want to capture input when you application is not active, you have only two choices: use SetWindowsHookEx(), or hack the kernel.
Now please go and try to do it before complaining that it won't work. And remember, if you want a system-wide hook, you will need to put your hook callback in a DLL.
Here's the official Microsoft Documentation.
At the end of the page here it says that you need at least Windows 95 or NT 3.1 (both the basic Win32 platforms). I've used hook procedures on XP, and they are still valid in Vista.
If you want to capture input when you application is not active, you have only two choices: use SetWindowsHookEx(), or hack the kernel.
Now please go and try to do it before complaining that it won't work. And remember, if you want a system-wide hook, you will need to put your hook callback in a DLL.
No, you need to compile your code into a DLL file of your own making. Windows won't let normal applications gain system-wide hooks because they can terminate anytime they like. A DLL, however, terminates only when the system is done with it. So when you set the hook, it must point to a hook procedure in a specific DLL.
So, you will need to create two projects: one to create the DLL which contains your KeyboardProc (and which you'll probably want to export other functions to give information about the hook) and one to create your EXE application which uses the DLL from the first project.
I know its a pain... but it is the only way to actually modify keyboard input when your application is not active. I'm sure there is a lot of sample code on the web to do just that...
Hope this helps.
So, you will need to create two projects: one to create the DLL which contains your KeyboardProc (and which you'll probably want to export other functions to give information about the hook) and one to create your EXE application which uses the DLL from the first project.
I know its a pain... but it is the only way to actually modify keyboard input when your application is not active. I'm sure there is a lot of sample code on the web to do just that...
Hope this helps.
![]() |
Similar Threads
- C command-line I/O question (C++)
- Apache Alias Directive... mod_alias question (Linux Servers and Apache)
- Completely new to C++ and have question about using char (C++)
- Question (Geeks' Lounge)
- question on cooling (Cases, Fans and Power Supplies)
- Context-sensitive grammar question :( (Computer Science)
- Welcome PC Mod Kingdom peeps! (Geeks' Lounge)
- Laptop LCD built into a car? (Monitors, Displays and Video Cards)
- Changing Network Configuration (*nix Software)
Other Threads in the C++ Forum
- Previous Thread: No output
- Next Thread: qsort Confusion
Views: 1410 | Replies: 10
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment based beginner binary c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






