Author Topic: Problems using "Perform a window Function" to focus Elite Dangerous  (Read 2191 times)

Terekhov

  • Newbie
  • *
  • Posts: 8
Hello all, I'm an Elite Dangerous commander, and I use VA to support my play. Whilst I do own some HCS voicepacks, the profiles I use are purely my own, and specialised to my game style (these days, I mainly fuel rat, so use VA in conjunction with the EDDI plug in to support that).

First thanks for this wonderful software, I have separate copies on all three of my PCs. Excellent value.

When I started in ED I was mainly using VR, so VA was invaluable. Back then, one of the simple commands that I created was just to Focus the ED client window, (if for some reason it lost control focus). I made simple a command "Focus Elite" which simply used a single action "Perform a Window function" Window title "Elite - Dangerous (Client)" - Display: Show. I don't remember having any issues with that, but it would have been 2 years ago.

Now I have to play in 2D (dual screen), and the fuel ratting means that I'm always switching between ED, An IRC application, web browsers, and sometimes other tool (and doing so in a hurry). I decided to resurrect the focus command and bind it to a joystick for those moments when I'm tabbed out of game, a hyperspace jump completes, and it's Ahhhhh STARRRRRRR!!!!! :)

I have come across what might be an issue. I'm not 100% sure if I'm using the Perform a window function command correctly, or if there is a bug.

The situation is:  VA 1.10.3, Windows 10 Pro, Dual screen. ED running in Windowed (1650x1024 wide window on a 1920x1050 wide screen). Assume we have a notepad, add a copy of Firefox open on the other screen, (and optionally the VA window open there as well). When I trigger the command to focus the ED window, it does not do so reliably (but it does fail in consistent ways).

If I have the Voice attack client itself focussed at when the VA command fires, The ED client window is activated as I want it to be (title bar shows window active, it receives control focus etc. - all good).

If I have another program (in my example, the notepad or Firefox) focussed when the VA command fires, the ED window does not get focussed or receive control input. I do see the icon for the ED client on taskbar start to flash, but the window itself remains in the background.

In both cases, I see the command fire recorded in the VA log window. The ED window is always correctly positioned, sized etc. It just needs to be focussed to receive control input. Historically I used "Show" as the function that the window function command uses, I have also tried "Normal" with the same results. I have 2 PCs currently in use, I see the problem on both of them,, and also across both the voice activated and button triggered versions of the command.

Voice Attack is NOT running as administrator (and I wish to keep it that way).

Any ideas?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Problems using "Perform a window Function" to focus Elite Dangerous
« Reply #1 on: October 07, 2022, 01:16:14 AM »
You are likely running into Windows' focus-stealing protection (as indicated by the flashing taskbar entry).

When VoiceAttack has focus, Windows allows it to switch focus, as it's the foreground application. When it's not, Windows can prevent it from doing so as a safety measure (this applies to all applications, not just VoiceAttack).


A workaround, which disables that protection entirely (for all applications) can be found here.

Terekhov

  • Newbie
  • *
  • Posts: 8
Re: Problems using "Perform a window Function" to focus Elite Dangerous
« Reply #2 on: October 07, 2022, 02:42:45 AM »
Thanks, that makes a lot of sense. I'll probably have to implement that.

I'll think about it more deeply first. for example, reading the docs makes me think that if I had VA launch my ED, then it might have rights to force ED into focus. The issue there is that I have 9 accounts (4 Steam, 3 FDev, 2 Epic) so making that work would likely be impossible (or extremely difficult)

Terekhov

  • Newbie
  • *
  • Posts: 8
Re: Problems using "Perform a window Function" to focus Elite Dangerous
« Reply #3 on: October 07, 2022, 03:42:48 AM »
Actually, thinking about it, I must be  able to achieve the same result, but not solely through that function.

I have some buttons on Streamdeck that can reliably focus ED, AdiIrc, and a browser window through which I access a fuel rats system. I must have a look at the process structure there and see if I can understand how that works.

I'll post back here if I find a suitably generic alternative method.

Terekhov

  • Newbie
  • *
  • Posts: 8
Re: Problems using "Perform a window Function" to focus Elite Dangerous
« Reply #4 on: November 12, 2022, 11:36:59 AM »
Just a follow up.

I tried a workaround using a mouse move and click in a screen location wher thr title bar of the game window would almost certainly be. That seemed to work OK.

Then instead I tried some other things. I sent a key up keystroke targeted at the game client window. That seemed to bring the game window to the foreground, (without ill effect so far, and irrespective of which window had focus at that time.) I'll probably stick with that solution.

Malic

  • Full Member
  • ***
  • Posts: 105
Re: Problems using "Perform a window Function" to focus Elite Dangerous
« Reply #5 on: January 05, 2023, 09:29:57 PM »
Something to look at is a little program called EDRunner on the ED forums, that watches your joystick inputs and then focuses on Elite.

It has saved me so much from crashing into stars for example, because I also play with VR.

Terekhov

  • Newbie
  • *
  • Posts: 8
Re: Problems using "Perform a window Function" to focus Elite Dangerous
« Reply #6 on: January 18, 2023, 11:34:09 AM »
(Sorry, I saw this reply, horrendously late)

Thanks Malic, I do remember you mentioning this on stream several times, however I think that in my case using that might cause me other issues.

I'm a very active Fuel Rat, that means I am switching focus between game and an IRC client many times a call. Sometimes flying the ship is more important, sometimes timely reporting in IRC is important(and a would not want a jogged stick reassigning focus) , other times, I simply don't want risk of the game getting focus (I might be flying a bearing hundreds of thousands of Ls away with the client logged out and I really don't want to jog a joystick and lose my bearing, so I leave the ED client out of focus for most of the run).

The solution I'm using at the moment is a desktop mouse click from VA. I run windowed, so I just need to keep the ED window in about the right place. I did think about having VA shuffle the window to the right spot to ruggedise this, but then identified a comedy bug in VA that scuppered that plan :) ( https://forum.voiceattack.com/smf/index.php?topic=4406.0 ). What I have works just about well enough at the moment, although I will ruggedise it if I get a chance.