Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VB

Setting focus on another application using Process name

3.00/5 (2 votes)
29 Jul 2011CPOL 58.7K  
How to set focus on another application using the process name

VB.NET code:


VB
If Process.GetProcessByName("ExternalApplication").Length >=1 Then
     For Each ObjProcess As Process In Process.GetProcessByName("ExternalApplication")
          AppActivate(ObjProcess.Id)
          SendKeys.SendWait("~")    
     Next
End If

The SendKeys coding is used to maximize the external application when it's minimized. See this link to see more SendKeys commands: http://www.developerfusion.com/article/57/sendkeys-command/[^].

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)