Page 1 of 1


Posted: Wed Sep 26, 2018 6:10 pm
by BenBaron
Hi all,

how are we supposed to run SimConnect_GetLastSentPacketID from a managed client in C#?

Until now, I was using

Code: Select all

[DllImport("SimConnect.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int SimConnect_GetLastSentPacketID(IntPtr hSimConnect, out UInt32 dwSendID);
to call the function directly from the SimConnect.dll.

But as I was not able to find a x64 version of SimConnect.dll to include it into my program, the above mentioned approach doesn't work any more.

Any suggestions?

Greets, Benny

Re: SimConnect_GetLastSentPacketID

Posted: Fri Sep 28, 2018 10:31 am
by BenBaron
Ok...I found it out myself.

In case someone runs into the same problem of some functionality not being available in managed simconnect and no native SimConnect.dll at hand:

Create a new C++ .dll project, include the SimConnect.h file and link to SimConnect.lib. Add a definition file to the project and export the functions you want to use (in my case SimConnect_GetLastSentPacketID). Then you can build your own SimConnect.dll and use the DLLImport in your managed project like shown in the op.

Greets, Benny