• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX and stay on top

Messages
20
Country
france
Good day all,
this is my first post in this forum, and probably my question has been answered some where, but the search engine did not find anything relevant.

What is the way to do for have a stay on top window over the fsx window?

I use C++Builder, and, in windowed mode, all goes well until the main window of FSX lost the focus.
When it recovers the focus, my window (wich is with fsStayOnTop style), is sent in the background and hidden behind FSX.
In full screen mode, that doesn't work at all...

Perhaps someone who has yet built such a window can point me in the right direction?

With best regards,

Robert
 
For this, you need to know at a minimum your window handle, and Flight Simulator's.

You can use FindWindowEx in the Windows API (user32.dll) using "FS98MAIN" as the window class, and optionally "Microsoft Flight Simulator X" is the window title. This gets you the handle to the main window for the next step, described using older VB code here, but the principle is the same:

http://vb.mvps.org/articles/ap199902.pdf

Hope this helps,

Etienne
 
Hi Etienne,
thanks for this very interresting link... now I understand why all the solutions laying on API calls do not work and I have a work around to make the things working.

I'll make a test asap.

Best regards,

Robert
 
Good point on localization and you are quite right it's never a good idea to use the window name. Perhaps the only time I can think of it being of use is when multiple windows have the same class (eg, FS98CHILD for example).

If you want to get an idea of what controls and message loops (read windows here), you can use Spy++ if you have Visual Studio as it will show anything out there registered as a window class in Windows. For .NET application, ManagedSpy++ (http://msdn.microsoft.com/msdnmag/issues/06/04/ManagedSpy/) does the same thing, but makes it .NET friendly.

Cheers,

Etienne
 
I also forgot to add that a window can only be moved on top of other windows it the same process space (windows created by the same process). It's not possible in Windows XP to change the owner of a window after it's been created (although you can change the parent within the same process space).

In full screen mode, FSX runs as the topmost window in its process space because that's the behavior of DirectX.

If your window is created from a DLL loaded by FSX (example, a panel or dialog), they will be owned by the FSX process so you should be ok. Child windows show in front of the parent window, even if the parent window is marked as topmost. Child windows in FSX have the class name FS98CHILD, including gauges.

If your window is created by an EXE, it will be in a different process space and I'm not sure there's a way to make it show in front of the main DirectX window if the DirectX app is in full screen mode. It also seems that DirectX resets the stack at every frame, making sure that your out of process window becomes hidden.

One exception to this may be the MessageBox() window, because that's an API modal window owned by the desktop.

Cheers,

Etienne
 
Last edited:
Back
Top