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

PDK DLL with external app

Messages
238
Country
unitedstates
Hi,

I wrote an app that uses Simconnect. Works pretty well. Now I'm thinking about porting it to use the PDK but I still want an external user interface. I'm thinking that a PDK DLL links directly to Prepar3D? If that's the case, my external app window would need a mechanism to communicate with it? If so, what is the best method of communication I can use between the DLL and my app? Is it possible to have a single instance DLL which links to both P3D and my app through their own respective interfaces? (E.g. one DLL loaded into memory that both apps talk to?)

Thanks!
Gregg
 
This is one way:
https://msdn.microsoft.com/en-us/library/ms810613.aspx
The others that come to mind are named pipes and Windows sockets.

Hi Doug,

Gosh, I guess I was too hopeful that I could use separate interfaces to call the same instance of a DLL. Having thought about it, I only need to send 'signals' to the DLL to reread a file from time to time...a byte or two. If I were to be able to create functions it would be like:

void RereadConfig() { // set a byte to have the other thread to reread the config file.
g_bRereadConfig = true;​
}

Then, in the P3D thread...

bool CheckConfig() {
if (g_bRereadConfig == true) {
g_bRereadConfig = false;
ReadConfig();​
}​
}

...if it were possible.

Seems a lot to manage a memory mapped file, named pipe or socket. Sockets are useful if it'll be between machines which I only lightly care about. It's been a long, long time since I've used named pipes to communicate between virtual machines on the same machine. Memory mapped files would work, no doubt, and are probably simpler than the other two.

Gregg
 
Your dll could hook the P3D message queue and then you could use a user defined message, sent from your app to the P3D window.
Alternatively, you could use a windows event, although this would require a separate thread in the dll to wait on the event being set by your app.
I think I like the windows message queue approach better.

Having finished my second coffee...
Why not use a custom FS event, that your dll can watch for? Send it from your app with SimConnect_TransmitClientEvent.
 
Windows event...hmmm. That'd be easier. So, that DLL doesn't have a window so, I guess what you're thinking is to create a hidden window in the DLL with its own message queue. Then, in the client app, use FindWindow(NULL, szName). Interesting.
 
Okay. If I can ask one more question. How do you debug these DLLs? Can you attach to it?
 
So, you set a breakpoint in the DLL source code and then attach to a running instance of Prepar3d?
 
Hmmm...thinking through this DLL approach with P3D, perhaps there's a simpler way?
 
Back
Top