Jump to content

Recommended Posts

Posted

Hello all,
I am using Prepar3D v4 and I am building home simulator of Beechcraft 1900D Carenado model.
I am using C++ using SimConnect SDK to control Events and Variable there is some switches that are using LVARs not simulation variables or events . I want to be able to control them using C++. For example LVAR called ASD_SWITCH_EXT_POWER Could anyone advice me what to do?

Posted
1 hour ago, hs118 said:

Any reason you wouldn't use a commercially available software like FSUIPC or Axis&Ohs?

No problem at all. All I need to be able to use it using C++ application if FSUIPC has a library which can be used will be good. But all I want to control using C++ code because I control other simulation variables and events using simconnect sdk.
Thanks in advance

Posted (edited)
1 hour ago, Mostafa Emad said:

No problem at all. All I need to be able to use it using C++ application if FSUIPC has a library which can be used will be good. But all I want to control using C++ code because I control other simulation variables and events using simconnect sdk.
Thanks in advance

Sure, I understand DIY. Best wishes in your search.

PS You may want to try fsdeveloper.com

 

Edited by hs118

My MSFS 2020 repaints: Flightsim.to - Profile of HStreet

Working on MSFS 2024 versions.

  • Commercial Member
Posted (edited)

In FSX/P3D (all versions) Simconnect is not enough to access LVars and execute XML expressions, you needed to use the Panel interface, which is different depending on the version. The Simvars accessible through Simconnect are only the A: airplane variables, not L: user vars

This also means, you can't do that from an out-of-process .EXE but, instead, you must use a in-process .DLL, which works differently if you use P3D V3 and below (or FSX) or P3D 4 or above.

- with FSX and up to P3D V3, you needed to use the Gauges API, by including the Gauges.h in your project, first obtaining a in-memory pointer to the PANELS.DLL, so that you could call various functions of that API, like register_named_variable, check_named_variable, set_named_variable_value, get_named_variable_value, execute_calculator_code, etc.

- with P3D from 4 and above, the access is more modern and C++-like, so you need to create a PDK-style, Plugin, which will get you access to the P3D::IPanelSystemV400* interface, which will give you access to many functions with names similar to the old Panels area, CheckNamedVariable, RegisterNamedVariable, SetNamedVariableValue, GetNamedVariableValue, ExecuteCalculatorCode, etc.

Since you are targeting P3D 4 or more, I suggest the 2nd approach, which is more modern, and the PDK will give you access to a lot more of features other than just variables so, check the PDK section of the P3D Help file, specifically the documentation of the IPanelSystemV400 interface.

 

Edited by virtuali
  • Commercial Member
Posted

Also, check this link on a post I made years ago on fsdeveloper, with a tutorial and some C++ wrapper classes to use LVars:

https://www.fsdeveloper.com/forum/threads/c-tutorial-a-class-to-handle-l-variables-in-c.429499/

Note that, this was written in 2014, before P3D V4 came out, so it uses the traditional direct access to the Panels.dll module, not the newer PDK interface which came out in 2017 with P3D4.

Posted
22 hours ago, virtuali said:

In FSX/P3D (all versions) Simconnect is not enough to access LVars and execute XML expressions, you needed to use the Panel interface, which is different depending on the version. The Simvars accessible through Simconnect are only the A: airplane variables, not L: user vars

This also means, you can't do that from an out-of-process .EXE but, instead, you must use a in-process .DLL, which works differently if you use P3D V3 and below (or FSX) or P3D 4 or above.

- with FSX and up to P3D V3, you needed to use the Gauges API, by including the Gauges.h in your project, first obtaining a in-memory pointer to the PANELS.DLL, so that you could call various functions of that API, like register_named_variable, check_named_variable, set_named_variable_value, get_named_variable_value, execute_calculator_code, etc.

- with P3D from 4 and above, the access is more modern and C++-like, so you need to create a PDK-style, Plugin, which will get you access to the P3D::IPanelSystemV400* interface, which will give you access to many functions with names similar to the old Panels area, CheckNamedVariable, RegisterNamedVariable, SetNamedVariableValue, GetNamedVariableValue, ExecuteCalculatorCode, etc.

Since you are targeting P3D 4 or more, I suggest the 2nd approach, which is more modern, and the PDK will give you access to a lot more of features other than just variables so, check the PDK section of the P3D Help file, specifically the documentation of the IPanelSystemV400 interface.

 

Hello, Thanks for your response I find it very helpfull.
My only problem now I am trying to use the PDK but there is errors if you could help with.
There is Pdk.h file in SDK folder / inc/PDK but I can't find the PDK.lib all I can find PDK.dll in the Prepar folder not in the SDK and still got errors like "IPDK" is undefined and "IPanelSystemV400" is undefined.
Could you help me with this problem?
Thanks in advance.

Posted
On 1/22/2025 at 4:00 PM, virtuali said:

In FSX/P3D (all versions) Simconnect is not enough to access LVars and execute XML expressions, you needed to use the Panel interface, which is different depending on the version. The Simvars accessible through Simconnect are only the A: airplane variables, not L: user vars

This also means, you can't do that from an out-of-process .EXE but, instead, you must use a in-process .DLL, which works differently if you use P3D V3 and below (or FSX) or P3D 4 or above.

- with FSX and up to P3D V3, you needed to use the Gauges API, by including the Gauges.h in your project, first obtaining a in-memory pointer to the PANELS.DLL, so that you could call various functions of that API, like register_named_variable, check_named_variable, set_named_variable_value, get_named_variable_value, execute_calculator_code, etc.

- with P3D from 4 and above, the access is more modern and C++-like, so you need to create a PDK-style, Plugin, which will get you access to the P3D::IPanelSystemV400* interface, which will give you access to many functions with names similar to the old Panels area, CheckNamedVariable, RegisterNamedVariable, SetNamedVariableValue, GetNamedVariableValue, ExecuteCalculatorCode, etc.

Since you are targeting P3D 4 or more, I suggest the 2nd approach, which is more modern, and the PDK will give you access to a lot more of features other than just variables so, check the PDK section of the P3D Help file, specifically the documentation of the IPanelSystemV400 interface.

 

Hello,
I have an issue if you could help with. I am trying to use IPanelSystemV400 class function but I facing some issues.
I have read the PDK Documentation files. It state that in order to use IPanelSystemV400 all I need to do is to include "gauges.h" file and I did so. And just wrote a simple code:
#include <iostream>
#include "gauges.h"
int main()

{

        FLOAT64 x=get_named_variable_value(43778);

}

This generates error while building: LNK2001: unresolved external symbol ImportTable.
Is there is any something I am missing or I should do?
Please advice.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...