473,466 Members | 1,286 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Active process

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
Aug 26 '07 #1
2 1390
>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

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Aug 26 '07 #2
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??

"Mattias Sjögren" <ma********************@mvps.orgwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Aug 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: microsoft | last post by:
Hi People, when I try to modify an active directory user programatically, I receive the following exception: The server is unwilling to process the request Reading the microsoft web site, I...
3
by: memHog | last post by:
I am trying to no avail, to create a program that every once in a while checks to see if another program is active. When it finds it isn't, it will make it active using the Shell command. VB 6.0...
1
by: windy | last post by:
Hi all, I wanna know the function to make an process active. i.e. I have my own process runing. And I want to pass the focus(active window) to another existing program on the process list what...
0
by: m.gelosa | last post by:
Dear all, I wrote some weeks ago about a problem with all the committing transactions blocked for many seconds in a Commit Active state. Well, finally I solved it and I just would like to share...
10
by: John Brown | last post by:
Hi there, Does anyone know how to (generically) determine the currently active form for an application using a "static" function (so I can call it from anywhere). There is no offiical way I've...
3
by: Rotsey | last post by:
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...
1
by: Rotsey | last post by:
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...
2
by: Qu | last post by:
Hi everyone. The short version: I need a way to change the currently active process at run-time. The long version: I need to get a directory path out of an external application. The only way...
0
by: Arthernan | last post by:
I have an Active-X control provided by a vendor that will inadvertenly crash while processing. The good part is that I do have a way to save information routinely as it is processing in the event...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.