473,387 Members | 1,365 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.

How to get the Process the Active Proces?

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
Jul 21 '05 #1
2 1316
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.

"DraguVaso" wrote:
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

Jul 21 '05 #2
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.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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

Jul 21 '05 #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...
2
by: DraguVaso | last post by:
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... ...
2
by: mwazir | last post by:
Hi all, I have a process thats starts in my application and only terminates when my application is terminated. I want to write the output and the errors of this process to a seperate log file....
4
by: hvj | last post by:
I need to run a .NET1.1 program in a .NET2.0 CLR. The .NET1.1 exe starts correctly in .NET2.0. Now I want to debug in Visual Studio 2005. But when I try to open the .NET1.1 project, Visual Studio...
6
by: technocrat | last post by:
i have a process thats in roll back state..i ts going on forever..i need to kill it and would like to restart it with some changes.... if not atleast i need to know the status of the rollback to...
5
by: Rob R. Ainscough | last post by:
I'm using the Diagnostics.Process approach to shelling out run the following: C:\Windows\System32\MSIEXEC.EXE /x {73F1BDB7-11E1-11D5-9DC6-00C04F2FC33B} /q ..FileName =...
3
by: jbenezech | last post by:
Hi All, I have a perl script which starts a java process using Win32::Process. Here is the code to start the java proces: Win32::Process::Create($ProcessObj, ...
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...
5
by: Saya | last post by:
Hi Folks, I have now spend app. 3 days to get the below scenario to work, but can not get there! ..Net version = 2.0.50727 Windows version = Microsoft Windows = Windows Server 2003 Now I...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.