PC Review


Reply
Thread Tools Rate Thread

Detecting which application currently has focus...

 
 
Paul Aspinall
Guest
Posts: n/a
 
      1st Dec 2005
Hi
I am trying to write a piece of code, which will tell me which application
currently has focus / which the user is currently working on. ie. if the
user is currently in IE, or Word etc....

How can I find this in .NET?

Thanks


 
Reply With Quote
 
 
 
 
Mattias Sjögren
Guest
Posts: n/a
 
      1st Dec 2005
>How can I find this in .NET?

Call the GetForegroundWindow Win32 API to get the window handle for
the foreground window. You can then for example call
GetWindowThreadProcessId to get the process that created the window.
And then use the process ID to retrieve any information you need about
the application.


Mattias

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

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting and setting focus Jake Microsoft Access VBA Modules 3 20th Apr 2009 06:46 PM
User input focus detecting? Pieter Breed Microsoft Dot NET Framework Forms 3 5th Jul 2006 05:24 PM
detecting when focus leaves a form Dean Slindee Microsoft VB .NET 1 21st Dec 2005 08:18 PM
Detecting which application currently has focus... Paul Aspinall Microsoft C# .NET 1 1st Dec 2005 08:01 PM
Detecting focus target Atlas Microsoft Access Form Coding 3 28th May 2004 10:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:48 AM.