65.9K
CodeProject is changing. Read more.
Home

Setting focus on another application using Process name

starIconstarIconstarIconemptyStarIconemptyStarIcon

3.00/5 (2 votes)

Jul 29, 2011

CPOL
viewsIcon

58703

How to set focus on another application using the process name

VB.NET code:

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/[^].