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

P3D v4 P3D PDK register property

Hello all
i'm trying to make my first ever PDK Addon
i started with Simobject even if it is hard cus i need it for an other addon
i made my way through by Copy paste, SDK docs and fixing visual studio Red lines
i finished all the needed declarations and the DLL just compiled
now i need to test it
so i wanted to register some properties to be used in LUA scripts in my objects
and visual studio is not accepting my code even if i copy paste a sample code, it just says that arguments don't match
i read the SDK doc about properties and even used their code : same error :|

here is what i did :

HRESULT RegisterProperties(__in __notnull ISimObjectManagerV400* pSimObjectMgr)
    pSimObjectMgr->RegisterProperty(GetClassId(), LPCWSTR("wsup"), LPCWSTR("l"), MyClass::GetMyDoubleProperty);

//// the function bellow is inside MyClass

    /*static */HRESULT GetMyDoubleProperty(__in const ISimObject& Sim, __out double& dProperty, __in int iIndex)
        dProperty = static_cast<const MyClass&>(Sim).v;

        return S_OK;

//and it throws this error :
//Severity    Code    Description    Project    File    Line    Suppression State
//Error (active)    E0304    no instance of overloaded function "P3D::ISimObjectManagerV400::RegisterProperty" matches the argument list    First attempt    %PATH\%C++ projects\First PDK attempt\First PDK attempt\MyClass.cpp    119

i need this DLL to only create a custom property that gonna be used in some LUA / XML scripts for scenery objects or simobjects

thnx in advance :)
 static HRESULT GetMyDoubleProperty(__in const ISimObject& Sim, __out double& dProperty, __in int iIndex)
        dProperty = static_cast<const MyClass&>(Sim).v;

        return S_OK;
Last edited:
 static HRESULT GetMyDoubleProperty(__in const ISimObject& Sim, __out double& dProperty, __in int iIndex)
        dProperty = static_cast<const MyClass&>(Sim).v;

        return S_OK;
Same :'(

HRESULT RegisterProperties(__in __notnull ISimObjectManagerV400* pSimObjectMgr)
    pSimObjectMgr->RegisterProperty(GetClassId(), TEXT("stuff"), TEXT("you"), MyClass::Get);

/// in the class
    static HRESULT Get(__in const ISimObject& Sim, __out double& dProperty, __in int iIndex)
        dProperty = static_cast<const MyClass&>(Sim).v;

        return S_OK;

// var names are just for testing

Screenshot (16).png
Ok. Try to set Unicode in project settings: General -> Project Defaults -> Character Set = Use Unicode Character Set.
And return S_OK for RegisterProperties.
thnx a lot, that removed the red line and i can compile now :)

i can't understand something, when it comes to events it says that it is like the vars but i can't get how an event can have a unit ?!
and does the PDK have a text service like in simconnect ? like the ATC menu or the green bar on the top (just to debug my DLL in P3D)

thnx in advance :)
Events for properties in terms of P3D connects name of event with your Set function.
I use Visual studio to debug dll. My projects settings are:
Debugging -> Command = $(P3D)\Prepar3D.exe
Debugging -> Working Directory = $(P3D)
note that P3D and P3D_SDK are user variables in Windows that points to directory where Prepar3D is installed and current version of SDK (I just change variable when new SDK is available).
(Optional: Debugging -> Command Arguments = "-fxml:$(OutDir)DevScenario_TP.fxml" for debugging scenario loading at startup)
Just press Debug -> Start Debugging this will start Prepar3D and you can set any breakpoints in your code and inspect variables.
so the events are just variables that send themselves when i set them ? will simconnect clients recive it ?
is there a way to know if the DLL works ? i can't run it from VS2017 and even in P3D, the properties are not there, i tried to access them through a simconnect app and i just get default result

how do we set a variable ? i tried many ways but all i get is compile errors
i tried to use the psdkservice::getreportingservice()->show alert and i can't see any alert :| even if i init the services

i feel like my DLL just doesn't load in P3D, i tried to force an error and the DLL crashed cus i got an error message that means it loads, but never work :|
I'm using Visual Studio 2015 and as far as I know VS2017 works the same. The trick is that VS automatically attach debugger to your dll from project output directory. You don't need to copy it somewhere every time.
1. Has you created add-on.xml file for your dll?
For my example above it's copied to the output directory of the project and contains that:
<?xml version="1.0" encoding="utf-8"?>

<SimBase.Document Type="AddOnXml" version="4,0" id="add-on">
  <AddOn.Description>Example to demonstrate how add local variables for existing user simobject for further SimConnect Access.</AddOn.Description>
2. Has you once registered your add-on dll for Prepar3D?
I use command line options:
* Start -> Run -> cmd
* Switch to Prepar3D installation directory:
cd %P3D%

* Register you add-on directory
"%P3D%\Prepar3D.exe" "-Configure: Category=Add-on Package, Operation=Add, Title=SimVariableModule, Path=D:\MyP3Dv4\Output\Debug\SimVariableModule"
3. Start Debuggin from Visual Studio as I mentioned before and make breakpoint inside DLLStart.
4. Check that your DLLStart function receive not null value of IPdk pointer as argument.
I sugguest you learn about OutputDebugString. Also, it would be extremely useful to know your experience regarding writing software. Makes it easier to know how detailed versus how simplified a response can be.
is there a way to use simobject manager :: create object and set it to my simobject class ? I don't wanna a user for my object it is just a variable holder

and how can I make my object update himself ? I tried update overridebut it uses a simulation class instead of the simobject class
and how can I make my object update himself ?
There are some ways:
1. Create simulation behaviour for your SimObject using ISimulation interface and P3D will process it with specified frequency when instances of your SimObject exists. (Simplest and recommended way)
2. Register static methods as Callbacks to the messages of sim events using EventService
3. Create a separate thread and do what you want there (the hardest way if you really need it)
i could implement simconnect in my DLL so i can control it trough events from an external client, now the problem is that in C++ we have to use While(quit == 0) { Keep calling the callback method;} and that actually just stop the code in an infinite loop (unless i exit P3D) and i think the 3rd way is the only available (my life is hard :p)
Without knowing what they're actually trying to do and understanding their level of programming knowledge, it's harder and harder to offer assistance without actually writing their code for them.
Even if i succeed creating the dummy object and register and get / set the custom var
It still shows that this var has zero as value in other simconnect clients and even in xml visibility conditions (L:MyVar, degrees) it shows zero
Like the var doesnt exist
i found this on a website.
"LVAR (correct would be L:Var) are Local Variables that only exist in the simulator itself and are not accessible from the outside via SimConnect. "

if this is right, that means I can't use any simconnect client to check my vars, this is a big problem cus i don't know other ways to debug my vars, as you can see from my previous post, my DLL succeeds registring the properties and even create the object but the Lvars are not really doing their job when it comes to visibility conditions

i can't check the Lvar from simconnect, right, the debug XML code that comes with the SDK doesn't work either, OK

what am I supposed to do to debug my vars?

is there a way to check if the variables are actually in the sim and well working?

and are the vars created by PDK considered as Lvars or Cvars (i get confused when i get into many bugs)
First of all we can't see you code, both PDK addon and SimConnect client. I can't tell you are doing right or wrong.
As far as I know, your statements are wrong. Properties and Events that you have registered to your SimObject are accessible from SimConnect clients (maybe scripts, I don't sure).
SDK states there are "simvar" and "event" not "LVAR" and "... can be used in gauges, animation and scenaries". What else do you want?
Hello guys
so i succeded registering the properties and found out the way how we work with them
but i got into a strange problem, like no logic at all :|

i made some properties yesterday and tried them in a simconnect client = it works!
i added new properties today and tried the same thing = it doesn't work :| actually yesterday's properties are still working but the new properties that i added (copy / paste / adjust variables and names) don't

it sounds crazy but it gives me Exception number 7 = unrecognized name

any thoughts ?
Try to unregister your add-on directory.
"%P3D%\Prepar3D.exe" "-Configure: Category=Add-on Package, Operation=Remove, Title=SimVariableModule"
Then run P3D and after that again register it
"%P3D%\Prepar3D.exe" "-Configure: Category=Add-on Package, Operation=Add, Title=SimVariableModule, Path=D:\MyP3Dv4\Output\Debug\SimVariableModule"
Use your Title and Path.