Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to activate an application from a keyboard hook.

0 views
Skip to first unread message

Dov Aharonson

unread,
Jan 17, 2006, 4:28:58 PM1/17/06
to
I need to create a keyboard hook and activate from the hook certain
applcations as a response to the user pressing certain kys. Can I use SHELL
from within keyboard hook? Is there other way?

Help is appreciated

Dov


jayen...@gmail.com

unread,
Jan 18, 2006, 2:16:49 AM1/18/06
to

jayen...@gmail.com

unread,
Jan 18, 2006, 2:16:50 AM1/18/06
to

Dov Aharonson

unread,
Jan 18, 2006, 6:52:11 AM1/18/06
to
Thanks for the good link,
I already have a functional keyboard hook, my question is what is the best
way to activate some application from my hook procedure for example each
time the user press F11 I would like my hook to activate Photoshop
application.
I need to do it without having any application that runs and can recieve
messages from the hook and do the acivation, the hook procedure itself
should activate the Photoshop.
<jayen...@gmail.com> wrote in message
news:1137568610.5...@g44g2000cwa.googlegroups.com...
> check this :
> http://www.codeguru.com/Cpp/W-P/system/keyboard/article.php/c5699/
>


Vipin

unread,
Jan 18, 2006, 9:49:30 AM1/18/06
to
You will have to:-

1) CreateToolHelp32Snapshot(...)/Process32First/Process32Next. Using which
you would get the list of the processes
Store it in a map<DWORD , string>, processid mapping to Process
executeable.

2) EnumWindows(...) and in the callback proceedure when you get the top
level window
handles, you should do GetWindowThreadProcessid(...) in your callback with
the HWND.
Then you should use the ProcessId to lookup in the map to see if the process
name matches Photoshop.exe[
if that is the name of the executeable]

3) Once your comparison suceeds, you should do SetForegroundWindow(hWnd) ,
hWnd is the
window handle for which your comparison in step (2) suceeeded. This will
bring your photoshop app
to the front.

--
Vipin Aravind
Microsoft - MVP

"Dov Aharonson" <d...@keyscan.com> wrote in message
news:uy3ugWCH...@TK2MSFTNGP14.phx.gbl...

Dov Aharonson

unread,
Jan 18, 2006, 10:33:50 AM1/18/06
to
I guess it is my falt, I was not clear enough.

The application I wish to activate (Photoshop in this case) is not running I
need to start it running. So as I said there is no window or process to look
for, we may assume that I do know the path to the application executable or
its relevant entry in the registry where I can get the path.

I hope this one is as easy as your last answere.

Thanks for the help

Dov

"Vipin" <Vi...@nospam.com> wrote in message
news:%23VNum5D...@TK2MSFTNGP10.phx.gbl...

0 new messages