Prevent in-game window from being displayed on top of the game when game is launched and app is running on desktop

When my app is open on the desktop and the game is launched, the window briefly grabs the focus (it’s an in-game window) before I get the event that the game is running (which lets me hide the window to display a loading screen). See the attached gif

window flicker

I would need a way to avoid that - either by preventing the app from being display on top of the game before I can react to it, or having an event I can react to when the window is about to be redisplayed in the game.

Impact: low. It’s a bit annoying, but it’s not preventing users from using the app.

@sebastientromp hi.
I can’t see the GIF as it’s very small…
Is your window should be a desktop window or an in-game window?

It’s an in-game window (that can also be displayed on desktop).

Can you download the gif from there? https://www.dropbox.com/s/h236roirnr8zvze/window%20flicker.gif?dl=0