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

How connect exe to .dll to get Panels pointer

Messages
11
Country
us-texas
This is my first post-any help would be appreciated. I am running P3DV4 and am using external C++ application that accesses sim vars via simConnect to publish them for other apps. My exe runs in an environment I do not control. This pattern worked well until a new AC model was introduced that uses custom XML gauges. Several sim variables have been replaced with L:vars and I am having trouble getting to them. I have searched web and forum. I have run Cabin Comfort. I first attempted to use gauges.h in my exe, then per forum advice modified gauges.h to use Panels instead of ImportTable (for example Panels->execute_calculator_code). I understood that the Panels pointer would be populated by simConnect, but since running .exe it wasn’t. So now using forum advice https://www.fsdeveloper.com/forum/threads/how-to-execute_calculator_code.430422/ to create a .dll (module, update dll.xml) that will populate the pointer and hoping to use this pointer in my exe to get the L:var data. I know the dll has to live in P3D root (or per Ed, in root/Modules folder). But, in order for my exe to use the .dll it needs it in its (the .exe’s) folder. I researched accessing .dll from different locations but there are many warnings not to do this. I don’t know how to connect my .dll in P3D to my .exe. How do I get to the Panels pointer? My dll is not using simConnect. If this is wrong approach, suggestions appreciated.
 

fs1

Messages
301
Country
brazil
You can load execute_calculator_code dinamically (LoadLibrary and GetProcAddress) from the panels.dll, in your module dll.
Then you can retrieve your variables and share them with your exe.
 

JB3DG

Resource contributor
Messages
1,325
Country
southafrica
If I understand correctly, you want to call panel.dll functions from your exe? If so, it is not possible to do that with an external process. You can read and write data between processes using Read/WriteProcessMemory but you can’t call functions directly across process. What you can do is call the panels.dll functions from your dll and store the data in a simconnect client data structure and access that from your exe.
 
Messages
11
Country
us-texas
Thank you both. Yes I was trying to access the functions from my .exe – I will not waste any more time trying to get the panels pointer to my .exe. If I understand correctly, I should retrieve all the L:var data in my module (.dll) then, I can retrieve the data in my .exe in one of two ways: use getters to access the external data, or using a “simconnect client data structure” to access the data. I’m not sure about the simconnect data structure, but will look into it. If I am not understanding, please correct me.
 
Messages
11
Country
us-texas
So, I'm stuck. I have a .dll that is loaded by P3d. I have a non-null Panels pointer. I am trying to get to a custom variable that was created by a 3rd party. I am not getting a valid ID on the variable name when I execute check_named_variable.
The custom model is defined in My Documents\Prepar3D v4 Add-ons
I have verified that the variable of concern is in the Add-ons folder in a few .xml files. For ease I am giving an example of my call using another variable in those .xml files.
ID myId = check_named_variable("L:paused");

This call always returns an ID of -1 (not found). Since the variable is already in the model, I did not think I had to register it. Any idea what I am doing wrong?

Caveat -- I am cheating at the moment for the timing of check_named_variables. I am just using a timer to check the variable once/sec. I realize that the variable will not be available until the custom AC is loaded, but the ID never changes from -1.

I do not know if I should have started a new thread for this question - advice appreciated.
P.S. nice signature.
 
Messages
11
Country
us-texas
Uggh, that was not a laughing face. It was a colon. Not sure how to escape the colon.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Click on the "CODE" option whenever pasting "code" into the forum:
Code:
("L:paused");
Arv3d.png
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Yeah, it's unfortunate that the smilies hijack some of the useful bits of "code" we like to post. I just noticed the new "Inline" option. I've never tried that before, so I wonder ("L:paused"); if it will work?

Yes! It does work... :cool:
 
Top