Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

How to get the Process the Active Proces?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DraguVaso - 30 Sep 2004 15:25 GMT
Hi,

In my VB.NET-application I need to get the Process that is currently active
on the screen of the user. I need it to get back to that application after
that I brought mine to the front...

for exemple: user types in Word...
my application triggers an event, has to come to the foreground (when it is
minimzed)
immediately after that the Word-process has to be set again to the front so
the user can continu typing in word (and not in my application).

I don't think Process.GetCurrentProcess is the good answer, because that
points always to my VB.NET-application.

Thanks a lot in advance,

Pieter
mklapp - 30 Sep 2004 18:31 GMT
Get the top window.  There are a number of ways to do it.  I am looking at an
MSDN article entitled 'Windows'  from 'Windows Management' and they have
calls that can get a handle to the top window and calls that can bring a
window to the top.  Two calls:

    GetTopWindow
    BringWIndowToTop

should do it. (No, I haven't doen this in windows but I have in other GUI
OSes.

> Hi,
>
[quoted text clipped - 14 lines]
>
> Pieter
Girish Bharadwaj - 30 Sep 2004 18:46 GMT
I doubt you being able to do so just through .NET framework. You might need
to use a system wide hook on the keyboard events and use
GetForegroundWindow() and follow it up to find the Process who owns that
handle (GetWindowThreadProcessId()) and find the process that way.
Of course, I am talking only about PInvoked methods. I dont know if there
are any direct mappings to .NET classes. You might be able to find PInvoke
signatures at www.pinvoke.net.

Signature

Girish Bharadwaj
http://msmvps.com/gbvb

> Hi,
>
[quoted text clipped - 14 lines]
>
> Pieter

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.