Jump to content
Sign in to follow this  
foster74

How to make ShellExecute not take focus?

Recommended Posts

foster74

When I use ShellExecute to run a program hidden, it always takes focus away from the current application. Is there anyway around this? Thank you very much.

Share this post


Link to post
Share on other sites
MrMitchell

You could run:

$windows = WinList() ;Get list of windows

ShellExecute(...)

WinActivate([$windows[1][0]) ;Activate the first window in the list

May or may not work, but worth a shot anyway...

Edited by MrMitchell

Share this post


Link to post
Share on other sites
WideBoyDixon

Share this post


Link to post
Share on other sites
youknowwho4eva

If you ran in with the minimize flag, would that make it so it doesn't get focus?


Giggity

Share this post


Link to post
Share on other sites
WideBoyDixon

Actually, take a look here: http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx

I guess the AutoIt ShellExecute simply calls the underlying Windows API. In which case, you can use 7 as the last parameter for SW_SHOWMINNOACTIVE. Then I guess you'd need to find the window and hide it. Try it:

ShellExecute("notepad.exe", "", "", "", 7)

WBD

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×