Question?

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Nov 2007
Posts: 290
Reputation: kv79 is an unknown quantity at this point 
Solved Threads: 7
kv79 kv79 is offline Offline
Posting Whiz in Training

Question?

 
0
  #1
Dec 15th, 2007
Hi to all.
Can i make a Window,who have a power to be always active but invisible for me?How?
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Question?

 
0
  #2
Dec 15th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 290
Reputation: kv79 is an unknown quantity at this point 
Solved Threads: 7
kv79 kv79 is offline Offline
Posting Whiz in Training

Re: Question?

 
0
  #3
Dec 16th, 2007
I read it a whole thing and it is not a easy.Yes it is help a little bit.
Because i need to learn this.
Do you have anything in C/C++ what monitoring the keyboard?
Thanks for your effort.
Last edited by kv79; Dec 16th, 2007 at 7:45 am.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Question?

 
0
  #4
Dec 16th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 290
Reputation: kv79 is an unknown quantity at this point 
Solved Threads: 7
kv79 kv79 is offline Offline
Posting Whiz in Training

Re: Question?

 
0
  #5
Dec 17th, 2007
Originally Posted by Duoas View Post
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.
WH_JOURNALRECORD and WH_KEYBOARD Is Windows 95/98/Me function.
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Question?

 
0
  #6
Dec 17th, 2007
How do you figure? SetWindowsHookEx() is a Win32 function, and is supported on every Windows OS since.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 290
Reputation: kv79 is an unknown quantity at this point 
Solved Threads: 7
kv79 kv79 is offline Offline
Posting Whiz in Training

Re: Question?

 
0
  #7
Dec 17th, 2007
I am not really certain but at the end of the Page of SetWindowsHookEx() write what OS supprot.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Question?

 
0
  #8
Dec 17th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 290
Reputation: kv79 is an unknown quantity at this point 
Solved Threads: 7
kv79 kv79 is offline Offline
Posting Whiz in Training

Re: Question?

 
0
  #9
Dec 17th, 2007
HI , I use Dev-C++
I using LowLevelKeyboardProc
In SetWindowHookEx()

When i need to point dll file,
do i need to point User32.dll ?or what ,how?

Do i need in Win32 Application to put all of this?
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Question?

 
0
  #10
Dec 17th, 2007
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.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum


Views: 1410 | Replies: 10
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC