• 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.

Automatically Close SimConnectText Menu [SOLVED!]

Messages
175
Country
panama
Hello,

I'm working on a project, and it requires to generate a menu in FSX using SimConnectText API function, the problem is that, I need to automatically close it via code when the user hits a shortcut key defined in my module, the thing is that there seems to be difficult to close it, I tried using the Spy++ tool to detect the Class name and Title of the SimConnect menu window, and I arrived to the conclusion it's "SimConnect Choices". I successfully removed the WM_VISIBLE style flag, and seems to be hidden, the problem is that the bottom FS98CHILD window that contains the virtual cockpit continues rendering the SimConnect menu as a ghost window and I have no way to tell that child window (virtual cockpit view) to refresh and render without the SimConnect menu image, the menu itself keeps as a ghost window above the virtual cockpit view.

Did someone else had came across the same issue as me and solved?

Cheers,

Manuel
 

ddawson

Resource contributor
Messages
862
Country
canada
Given that you have worked out the class name, could you not retrieve a handle to the window and then throw a WM_DESTROY message at it?
 
Messages
175
Country
panama
Yes I did retrieved a handle to "SimConnect Choices" which is the child window that holds the menu displayed by the SimConnectText API, but once I send WM_DESTROY (using the WinAPI DestroyWindow), the window disappear, but if it's docked window the ghost image of the child window will keep persistent and being rendered by the bottom child window in the Z order, and then if I try to show that window using SimConnectText, it wont show it,....its a bit weird behaivor.

Manuel
 
Messages
757
Country
netherlands
SDK says:

If an empty string is sent in pDataSet along with an EventID that matches a menu or text in the queue (see Remarks below), that entry will be removed from the queue, with the SIMCONNECT_TEXT_RESULT_REMOVED event being returned to the client.

Now it's been a while since I worked with menues, but as I recall, this worked quite well to remove the menu screen.
 
Messages
175
Country
panama
Now it's been a while since I worked with menues, but as I recall, this worked quite well to remove the menu screen.

I'm creating a menu like this somewhere in my code:

Code:
#define EVENT_MENU_MAIN_MENU = 8

SimConnect_Text(hSimConnect, SIMCONNECT_TEXT_TYPE_MENU, 0, EVENT_MENU_MAIN_MENU, dwMenuSizeBytes, (LPVOID)szMenuContent);

Then somewhere else, I send the following to close that same menu automatically while it's being shown on screen.

Code:
SimConnect_Text(hSimConnect, SIMCONNECT_TEXT_TYPE_MENU, 0, EVENT_MENU_MAIN_MENU, 0, (LPVOID)"");

But this last call doesn't seems to close the menu. I don't know what I'm doing wrong? :banghead::duck:

Cheers,

Manuel Ambulo
 
Messages
757
Country
netherlands
Does it clear the menu text though?

Either way I'm not sure 0, (LPVOID)"" resolves to actual empty string as per internal handling.

maybe try doing it as per example:

Code:
static const char Empty1[] = "";
...
// Stop displaying menu
SimConnect_Text(hSimConnect, SIMCONNECT_TEXT_TYPE_MENU, 0, EVENT_MENU_1, sizeof(Empty1), (void*)Empty1);
 
Messages
175
Country
panama
Does it clear the menu text though?

Either way I'm not sure 0, (LPVOID)"" resolves to actual empty string as per internal handling.

maybe try doing it as per example:

Code:
static const char Empty1[] = "";
...
// Stop displaying menu
SimConnect_Text(hSimConnect, SIMCONNECT_TEXT_TYPE_MENU, 0, EVENT_MENU_1, sizeof(Empty1), (void*)Empty1);

AWESOOOOME!...a very SIMPLE and SMALL detail like that was the solution to my problem, even tho that seemed to be same thing:

Code:
      0, (LPVOID)""
      sizeof(Empty1), (void*)Empty1);

It made a HUGE difference, NOW IT'S WORKING!!!!..THANK YOU!!!

THANK YOU AGAIN!

Manuel Ambulo
 
Messages
757
Country
netherlands
Figured. C strings can be... weird. but I guess MS had to have their reasons not to go with C++ style std strings.
 
Messages
175
Country
panama
Figured. C strings can be... weird. but I guess MS had to have their reasons not to go with C++ style std strings.

Yep, I guess same, it's good to have this issue solved, I spent almost 2 weeks thinking in different ways to achieve this, even thought in actually debug FSX and find someway of hacking method to make this happen, but it's very good to know there is a way to close the menu WITHOUT hacking, which converts into pain when there are so many FSX versions out there: RTM, SP1, SP2, ESP, Steam, etc... hehehehe

THANKS A LOT!
 
Top