Set Focus to a particular process

  • Thread starter Thread starter Saurabh Sharma
  • Start date Start date
S

Saurabh Sharma

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
 
Hi,

You do not focus on a process, in any case you focus on a form, you can use
Process.MainWindowHandle to get the ID of the main window, then you can
focus it by using SetForegroundWindow

Note that even doing this you cannot assure that the expected window to be
focused , just the main window of the process.

cheers,
 
That is working only for the main form but if it is in another form then its
not working. Is there any method to do that.

Regards
Saurabh
 
Hi,


AFAIK there is not, can you change the target app?


cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top