Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27034

VS 2010 How to set focus (activate) other application from my app?

$
0
0
Hello,
I am frustrated :(
Searched all night long, even Google gave up.

What I am trying to do is to focus other application that currently running by its processID or windowTitle or by ID only (process number)
I tried to do it the noob way:
Code:

AppActivate(appid) ' activated but not focused
SendKeys.Send("%{TAB}") ' switch back to Me
SendKeys.Send("%{TAB}") ' switch to show the program

This works but sometimes its getting stuck and PC freeze and I am sure its not how its done.
Also tried this:
Code:

Dim processID As Integer
processID = Shell("NOTEPAD.EXE", AppWinStyle.NormalFocus)
AppActivate(processID)

Tried a lot of different code files that I found but noting do what I need it to do.
every code I found not work or only half working :mad:

Is it really that hard to focus other app window by its id,name etc? VB.net can get any PC info with only one line of code (my. ...) but its can't focus other window? I give it all the info, why is it so hard?
Its impossible without all the User32 stuff?

Please help!
Thanks!

Viewing all articles
Browse latest Browse all 27034

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>