FSX:SE Pop up window

#21
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.
 
#22
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 :)
 
#23
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 :(
 
#24
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?
 
#25
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 :(
 
Top