473,405 Members | 2,171 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,405 software developers and data experts.

How to give focus to a 2nd process?

I'm using a browser to display documentation. I've got a Process object to
it stored, but can't find a way to give it focus the 2nd+ time the user
presses the help button.
Feb 1 '06 #1
3 1417
I'm using a browser to display documentation. I've got a Process object to
it stored, but can't find a way to give it focus the 2nd+ time the user
presses the help button.


Try using the SetForegroundWindow Win32 API, something like

SetForegroundWindow(yourProcess.MainWindowHandle);
Mattias

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

.... If that doesn't work you can probably post a bring to front or
focus message to the other process via the Process.MainWindowHandle
property

Feb 2 '06 #3


"Mattias Sjögren" wrote:
I'm using a browser to display documentation. I've got a Process object to
it stored, but can't find a way to give it focus the 2nd+ time the user
presses the help button.


Try using the SetForegroundWindow Win32 API, something like

SetForegroundWindow(yourProcess.MainWindowHandle);


THankyou. That's exactly what I was looking for.

Feb 4 '06 #4

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

Similar topics

1
by: | last post by:
I'm trying to get (or set) the focus on an external window but to no avail. I've imported the "GetActiveWindow" and "GetFocus" from the user32.dll but those 2 functions seem to only work for windows...
3
by: Saurabh Sharma | last post by:
Hi I found a particular process that is running on my machine. I have th eprocess ID for that how to set Focus to that Process Regards Saurabh
2
by: Christian Ista | last post by:
Hello, I found that (see below) to give the focus to a control(textbox) on an asp.net page. There is no easiest way to do that ? Thanks, System.Text.StringBuilder sb = new...
0
by: Elliot | last post by:
The following code creates 2 node objects in a treeview control. When I click on the second node, a process object corectly launches "http://www.cnn.com" but focus immediately returns to the...
0
by: hzgt9b | last post by:
Using VB .NET 2003, I am having problems with a windows application that I have written: Here's the situation. The application I created has a main form that has its TopMost property set to True...
3
by: Sharon | last post by:
I need to allow single instance of my process. I did found the other System.Diagnostics.Process as follow: System.Diagnostics.Process currentProcess =...
3
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I am not sure what am I doing wrong here. I spend almost whole day working on this. I am trying to set focus on the process that I started by Process.start. Below is my code...
1
by: Mex | last post by:
Hi Im using a Process component to run external application (FineOCR.exe) In StarInfo i set theProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; When the process...
1
by: massimo s. | last post by:
Hi, I would like to know if 1)there is a Python way to tell under which terminal process a Python command-line application is running 2)there is a Python way to tell the OS to give focus to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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...

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.