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

Display messages via SimConnect?

Messages
203
Country
unitedstates
Has anyone figured out the trick to send message strings to FSX via SimConnect or the C++ gauges?

This used to be the old adventure message string, but it's not documented anywhere I've been able to find.

One way is to draw a window on the screen with a transparent background but I was hoping to use the "normal" way...

Cheers,

Etienne
 
You can do it with FSUIPC. But I don't know how Pete implemented this, via simconnect or by visiting the good ol' FS internals ;)
 
I've done it in FSUIPC, but was hoping that SimConnect would support it. Perhaps the next SDK version...

Cheers,

Etienne
 
You can do it from inside FSX and relay to the functions via simconnect client data areas and client events

Attached file is an example of how to do this. See Send Event A,B,C of SDK Samples. Maybe not the best way since I've not used simconnect client data so much. Very dirty too ;)

View attachment advbarserver.cpp.txt
 
Very, very sneaky, dirty and smart... Thanks so much for the tip, un tres grand merci :)

Etienne
 
Last edited:
Is it possible to do the same for other dialogs like the ones on the missions or the flying tips?

By the way, how do you found that (char *) 24?????? :confused: :confused:

Best Regards
 
I looked at the import/export tables of FSX dll modules. But it was purely luck I found the right function at the second try ;)
I have absolutely no knowledge of FS internals or assembly. I doubt accessing other UI related functions will be so easy.
 
FSX DLL don't export function names, you have to give the ordinal instead. The cast is just here to prove we can do elegant polymorphism in C :D
 
But, lc0277, how did you figured out the arguments or parameters that it was needed to pass to the procedure exported in the WINDOW.DLL?...because the dependency walker..just displays the ordinal, and entry point of the procedures, but...how did you know how many and what types of arguments (char msg[256], int style, int delay, int cleanup) <--- how did you figured out them??...

Best Regards,

Manuel Ambulo
 
Luckyly enough, they are exactly the same as FS9, just the function ordinal has changed.

Now, you might say "how did you figured out in FS9"... :)
 
:confused:
Luckyly enough, they are exactly the same as FS9, just the function ordinal has changed.

Now, you might say "how did you figured out in FS9"... :)

Lol, yeah...."how did you figured out in FS9".....because, in FS9 for access WINDOW.DLL....there is the linkage system, and i think that for access to the exported functions list, i need to specify the MODULE ID of the WINDOW.DLL module, then a pointer which will be filled with the pointer that points to the list of functions exported by the WINDOW.DLL, the problem (for me)..is to know HOW MANY and WHAT TYPES of arguments need each one......i think (or i believe..that you may need some assembler knowledge to get that information...lol...:confused:)....i know that they are not exported with the names of the functions, so then i may guess you ran all pointers (which in some cases if you try to run the functions from your module (without passing any arguments to it...)..FS will crash...thats why i guessing how you did it....??? :confused:...)....lol :eek:

Best Regards,

Manuel Ambulo
 
Using the linkage system it's not the only way of calling an FS function. Once you find the correct prototype, you simply declare a "pointer to function " variable, assign its address with GetProcAddress(), and you call the routine normally.

assuming you found in the module "XXX.DLL", the function with ordinal 10 takes two doubles in input and returns an int, with the "standard" calling conventio, the prototype will be, in your .H

Code:
typedef int (__stdcall *MyNewfoundFunctionFunc) ( const double, const double );

in your .CPP file, you declare and init a variable of this new type:

Code:
MyNewfoundFunctionFunc MyNewfoundFunction = 0;

at start of your program, you do something like this:

Code:
HMODULE hMod = GetModuleHandleA( "XXX.DLL" );
if( hMod )
{
  MyNewfoundFunction = (MyNewfoundFunctionFunc)GetProcAddress(hMod, MAKEINTRESOURCEA( 10 ) );  // assuming the ordinal it's 10, for example
}

from now on, in your program, you can call the function as if it were a regular function according to its prototype, like this:

Code:
int result = MyNewfoundFunction( 3.0, 4.3 );

Of course, to figure out the parameters types, a disassember AND some asm knowledge it's helpful, and of course the use of a debugger with breakpoints. Also, using the wrong calling convention, as well the wrong parameter types, will usually make FS crash, so yes, some care is needed.

Usually, it's much easier to figure out parameters if the function name is "decorated", you'll recognize the names with those funny "@!""3213£@##!" characters appended. In that case, the parameters are encoded in the name itself, so a good disassembler should be able to decode them and give you some basic prototype (of course, no disassembler will be able to tell you what the parameters DO, even if they are correct and not crashing FS, their actual meaning can't be figure out without following the actual assembler code to see what they are really doing ).

Yes, it's a long a tedious work, not really my idea of having fun. I think we should lobby Microsoft into convincing them to extend Simconnect to officially support these kind of things as well...
 
If the function is simple (or expected to be) using a debugger is generaly enough. Just put a breakpoint and watch the values on the top of the stack at each call.
With some habits and knowledge about your adress space, differents data types can be easily distinguished :
code pointers (meaning function pointers or return address, thus the begin or end of arguments),
heap pointers (allocated data, mainly big control structures),
stack pointers (temp data, format strings, ...).
integers or floating point numbers (formatting random bits to a float has very little chance to give a number between -100. and +100.).

VC++ Express has a good debugger which can format data on the fly to quickly find strings or numbers.
After that you had to guess or experiment.

But if the function is more complex, eg if it takes structures or pointers to structures which are not documented (ie we don't have the corresponding header file), this process is nearly impossible. :confused:
C++ function calls are even worst, since you have to provide a pointer to this in registers, not on the stack.

I agree with virtuali, this process is not funny and is clearly not what add-on developers are expected to do. Simconnect has changed the way we can communicate with FS, and we should really try to convince MS to make it more feature-rich.
 
Really but really dirty it will be to intercept DirectX device pointer.

http://www.codeguru.com/cpp/g-m/directx/directx8/article.php/c11453/

José

Thanks, jcboliveira, i didnt knew that it was possible to intercept calls made to a DLL. When you posted it, i went searching in internet and found some interesting documents that explains how to intercept API calls made to DLLs like (user32.dll).:eek:


Usually, it's much easier to figure out parameters if the function name is "decorated", you'll recognize the names with those funny "@!""3213£@##!" characters appended. In that case, the parameters are encoded in the name itself, so a good disassembler should be able to decode them and give you some basic prototype (of course, no disassembler will be able to tell you what the parameters DO, even if they are correct and not crashing FS, their actual meaning can't be figure out without following the actual assembler code to see what they are really doing ).

Yep, it is much easier, because Dependency Walker has an option that can "undecorate" the "decorated" functions (as far as i remmember, is the version 2, of Dependency Walker..).



If the function is simple (or expected to be) using a debugger is generaly enough. Just put a breakpoint and watch the values on the top of the stack at each call.
With some habits and knowledge about your adress space, differents data types can be easily distinguished :
code pointers (meaning function pointers or return address, thus the begin or end of arguments),
heap pointers (allocated data, mainly big control structures),
stack pointers (temp data, format strings, ...).
integers or floating point numbers (formatting random bits to a float has very little chance to give a number between -100. and +100.).

VC++ Express has a good debugger which can format data on the fly to quickly find strings or numbers.
After that you had to guess or experiment.

But if the function is more complex, eg if it takes structures or pointers to structures which are not documented (ie we don't have the corresponding header file), this process is nearly impossible.
C++ function calls are even worst, since you have to provide a pointer to this in registers, not on the stack.

I agree with virtuali, this process is not funny and is clearly not what add-on developers are expected to do. Simconnect has changed the way we can communicate with FS, and we should really try to convince MS to make it more feature-rich.

Yesterday, during my search in internet, i also found a tool called OlllyDbg v1.1, which can open DLLs, and see it in assembler, the good thing is that the program has an analyzer that tells me how many calls are made, and where are there come from. Analyzing the FSX's DLLs is a bit much easier, because i can see the exported functions (just the module name and ordinal, example: "util.#28", which means that a function exported in util.dll, with ordinal 28) of other FSX modules, there in the code, but openning the FS9 modules, its a bit more different (and complex for me) because of the linkage system (i think), i cannt see the exported functions directly....and yeah, as virtuali said, is really a pain trying to figured out arguments...:banghead: :(

Best Regards....:coffee:,

Manuel Ambulo
 
A BIG THANKS!!....JCBOLIVEIRA, LC0277 AND VIRTUALI..... because,....i learnned a LOT!, since you guys posted those posts above, i investigated in internet about how is the ASSEMBLY language and the method to intercept API calls, i found some interesting documents, and since that day i had been playing around with my old FS9's modules and i had discovered how to figure out how many parameters that some functions needs to run (exported functions bettween FS9's modules), however..i still dont know the type or size of each parameter and as LC0277 said it is really hard if they are pointers to structures (or pointers to pointers)....and also, during my playing time with FS9 modules, i found where it is located the AdvBar function that LC0277 found in the WINDOW.DLL of FSX,......yes...it is the same function but it has different ordinal (located inside of the LINKAGE of the WINDOW.DLL of FS9)..REALLY COOL ...so thanks JCBOLIVEIRA, LC0277 AND VIRTUALI..... i do really found many cool stuff....in FS9's MODULES (and in FSX MODULES), the problem, of course, is to figure out what each function do...(which is REALLY HARD)...:)...


José, this is incredible. It is openning a lot of possibilities. But is it possible to use it from a C# program? How?

Sorry but I'm not familiar at all with C++

Yep, it is really incredible :D


Best Regards,

Manuel Ambulo
 
Last edited:
Back
Top