Jump to content

Open Firefox without loosing focus in current program


AutoNL
 Share

Recommended Posts

Hello,

I'm trying to to the following 

 $iPID = Run(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe "http://google.com"', '', @SW_SHOWNOACTIVATE
or even
 $iPID = Run(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe "http://google.com"', '', @SW_MINIMIZE

But Firefox still takes over the focus. 
Actually I'd like to open Firefox without changing focus. So if user is typing mail in Outlook he can go on with it 
Is it a correct approach? 

Link to comment
Share on other sites

I think adding the url on the command line FF is going to open it and get the keyboard focus.  I would try @SW_HIDDEN.  If that works then you can figure out how to call show on it later.  Perhaps using the Firefox window class name or something similar.

Edit: if @SW_HIDDEN does not produce the desired effect you could save the window handle of the active window, run FF and do a wait for the window to exist.  As soon as it exists try to hide it, or if that fails as soon as it is active, return the focus to the window that was active.  If it happens quick enough you might not see any flicker. Just have to go at it trial and error.

 

 

Edited by MilesAhead
Link to comment
Share on other sites

Thnak you.

I hoped for a better solution.  But this is acceptable in my case:

      $handle = WinGetHandle("")
      $iPID = Run(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe "http://google.com"', '', @SW_SHOWNOACTIVATE)
      WinActivate (HWnd($handle))

 

Edited by AutoNL
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...