473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Is My App Currently Active?

In order to find out, if my app is currently active, I'm using API function
GetForegroundWindow().
However, as soon as my app opens a dialog (specific window or even just a
message box), the handle of the dialog form is returned by
GetForegroundWindow(). In case of a message box, I don't even know the
handle and have no idea of how to retrieve it.
I have tried API function EnumChildWindows(), but that returns only the
rectangles the main form is composed of; apparently it does not return an
open message box.

Is there a feasible way of determining of my app is the active app?
Thanks in advance for you help!
Thomas
Jun 21 '07 #1
1 936
>Is there a feasible way of determining of my app is the active app?

Well since you're already calling Win32 APIs, how about checking

uint fgProcessId;
GetWindowThreadProcessId(GetForegroundWindow(), out fgProcessId);
if (fgProcessId == GetCurrentProcessId()) ...
Mattias

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

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

Similar topics

1
by: anonymous | last post by:
Hi all, I've been searching the way to achieve the following task. But no luck so far. I have a web site(main site), which requires authentication. This authentication is set at Windows...
3
by: Dustin Aleksiuk | last post by:
Is there a way to get a list of all the session objects currently running in my web app? I've been looking through the API but I can't find anything yet. In this app, every user gets a certain...
0
by: Hamid Ozair | last post by:
Would it be possible to write an asp script that would poll two web servers and send traffic to the currently live server? Would we also need a program running in the background on the server...
0
by: rkagrawal | last post by:
I have come across this question many a times , i have a solution in my mind and i think it is effective enough to be used . I need your opinion so that i can complete this idea and release the...
8
by: salad | last post by:
I was wondering how you handle active/inactive elements in a combo box. Let's say you have a combo box to select an employee. Joe Blow has been selected for many record however Joe has left the...
0
by: fblake | last post by:
FOR IMMEDIATE RELEASE Active Up expands ever popular product line Active Web.Controls 2007 V1, Active Cells V2 and Active AutoSuggest V1.0 Belgium (February 2007): Active Up today released...
6
by: MuZZy | last post by:
Hi, I am looking to find a way to get currently logged in user's object GUID without querying ActiveDirectory. For example, when i log in to my laptop from home, I'm not on the office network so...
1
by: gover | last post by:
Hello, Is ther an API I can use to get a list of / or the number of users currently logged on to an iis6 or iis 7 web app. I Know IIS keeps a seesion for each user. how can i get an enumeration of...
1
by: webcat | last post by:
hi all, how about this? I want to allow users to click a check box on a form to 'flag for testing' thats fine - works great but what if there is 100 records and the user wants to flag...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.