Active process

R

Rotsey

Hi,

I am writing app that I want to be able to hit a shortcut
key (windows wide) and have it all launch my app and then
be able to get the name of the process that was active when
the key was pressed.

Is this possible and how?

I know I can assign a shortcut key to the app but how do
I get the active process name?

rotsey
 
M

Mattias Sjögren

I am writing app that I want to be able to hit a shortcut
key (windows wide) and have it all launch my app and then
be able to get the name of the process that was active when
the key was pressed.

Is this possible and how?

The GetForegroundWindow Win32 API function will tell you which window
is in the foreground. GetWindowThreadProcessId will tell you which
process that indow belongs to.


Mattias
 
R

Rotsey

ok great Mattias

So the first thing my app has todo then is call GetForegroundWindow
and then GetWindowThreadProcessId I'lll know the process name.

Then I can load a window that I want to be open for a few seconds
then removed.

Then the process before will be active again, is this correct??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top