• 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:SE Pop up window

I have found a solution, not perfect by the way.
I guess that P3D (FSX) uses DirectSound (dsound.dll) primary buffer. I have tried to add DirectSound to the Pop-Up window and do some Cooperative, but I don't know what settings P3D (FSX) uses. If sim have used DSBCAPS_GLOBALFOCUS may be it will be possible. So when P3D window is in background or loose focus the sim sound is muted.
Let's try to display our window on top of sim and give back focus to the sim window.
1. Take the handle to the main window of P3D (FSX)
C++:
HWND P3DMainWindow = FindWindow(L"FS98MAIN", NULL); // Get P3D main window handle (there is only one window with FS98MAIN window class inside the process)
2. After processing your window messages (user input for example) put sim window to the foreground. If you done this fast enough the sound will not be interrupted.
C++:
SetForegroundWindow(P3DMainWindow);
Buttons and timers works fine, but for textbox input you will need some hack.
 
I thought the same about the sound. As you say, FSX certainly uses DirectSound primary buffer, but I am sure it does not use the DSBCAPS_GLOBALFOCUS value, otherwise there would be no problem, the FSX sound would be heard when FSX window loses focus. This is why I was looking for a way to find the primary buffer created by FSX in order to change its DSBCAPS and change it to DSBCAPS_GLOBALFOCUS, but I'm afraid this is impossible.

The solution you propose with SetForegroundWindow may work, I will try it ASAP and let you know. At this time I don't use text boxes and I don't think I will need them, so it should be fine.
Thanks for the idea :)
 
I have just tried this and... it works and doesn't work.
I think it was implemented correctly because when my map window is visible, the key presses are still handled by FSX. For example, if I press L while my window is on screen, it switches the lights on/off. Nevertheless, the FSX sound is still muted :(
 
I will look again into my code, maybe I placed the SetForegroundWindow at the wrong place. Even if it doesn't work at this time, I am almost sure it is the right way to go.
I heard the FlightSimCommander does the same: it keeps the FSX sound while the FSCommander window is visible. Does any of you use this software and know if it is true?
 
I made other tests, without any success... I tried to move the "SetForegroundWindow" to other places in the code, but it still doesn't work. I also tried "SetActiveWindow" and the result is the same: not only it doesn't work as expected (the FSX sound is still muted) but I can't quit FSX... When the FSX confirmation appears to quit, I can't press the "Yes" button. I mean, I can click, but nothing happens and I have to kill the FSX process in the task manager :(
 
Back
Top