MyDispatchProcTC called only once.

lvedin
Posts: 22
Joined: Wed Aug 01, 2018 6:58 am

MyDispatchProcTC called only once.

Postby lvedin » Tue Sep 25, 2018 7:17 pm

Now I have test one variant of NoCallback.cpp , and also the Console app Sample: ThrottleControl.cpp exactly as the sample unmodified.

Those samples give similar fail.
MyDispatchProcTC is called only once while i call SimConnect_CallDispatch regular. Similar for NoCallback.cpp SimConnect_GetNextDispatch success once, then fail. P3D is set to not pause.

The return parameter in first call is same in both cases:
pData:
dwSize = 308
dwVersion = 29
dwID = 2

cbData = 308
pContext = 0 (MyDispatchProcTC )

In all other call SimConnect_GetNextDispatch returning E_FAIL with parameters pData=null, cbData= 0
While the MyDispatchProcTC sample is only called once.

I use Visual Studio Community 2017 Tool, default 32-bit. SimConnect.lib and SimConnect.dll from P3D v4 FSX-SP2-XPACK.
I did run the SimConnect.msi but I don't know what the installation really does. I anyway add the lib to the project and put the dll to my source. No fail to build and no complain dll is missing.

Platform toolset is Visual Studio 2017 (v141). toolset 2015 v140 is not available.

I have a connection to P3D. What can the problem be ?

Log view:
0.00000 SimConnect version 4.3.0.0

0.00389 Server: Scope=local, Protocol=Pipe, Name=\\.\pipe\Lockheed Martin Prepar3D v4\SimConnect, MaxClients=64
0.00703 Server: Scope=local, Protocol=Pipe, Name=\\.\pipe\Microsoft Flight Simulator\SimConnect, MaxClients=64
0.00980 Server: Scope=local, Protocol=Pipe, Name=\\.\pipe\Microsoft ESP\SimConnect, MaxClients=64
0.01567 Server: Scope=local, Protocol=Pipe, Name=\\.\pipe\Lockheed Martin Prepar3D\SimConnect, MaxClients=64
0.01832 Server: Scope=local, Protocol=Pipe, Name=\\.\pipe\Lockheed Martin Prepar3D v2\SimConnect, MaxClients=64
0.01988 Server: Scope=local, Protocol=Pipe, Name=\\.\pipe\Lockheed Martin Prepar3D v3\SimConnect, MaxClients=64
0.02137 Server: Scope=local, Protocol=Pipe, Name=\\.\pipe\Lockheed Martin Prepar3D v4\SimConnect, MaxClients=64
0.02261 Server: Scope=local, Protocol=IPv6, Address=::1, Port=63487, MaxClients=64
0.02372 Server: Scope=local, Protocol=IPv4, Address=127.0.0.1, Port=63488, MaxClients=64

0.02489 DLL Loaded: Path="SimObjects\Modules\Utilities.dll" Version="<Unknown>"
0.02599 DLL Loaded: Path="CIGI.dll" Version="<Unknown>"
0.02752 Panels data export found and set to 00007FFD1DE8CB80
0.02763 DLL Loaded: Path="radar.dll" Version="3.0.0.0"Unable to read VR Path Registry from C:\Users\Lennart\AppData\Local\openvr\openvrpaths.vrpath

0.03278 DLL Loaded: Path="VirtualReality.dll" Version="3.0.0.0"
0.03380 Panels data export found and set to 00007FFD1DE8CB80
0.03387 DLL Loaded: Path="ControllableCamera.dll" Version="<Unknown>"
0.03512 Panels data export found and set to 00007FFD1DE8CB80
0.03551 DLL Loaded: Path="Gauges\TargetInfo.dll" Version="<Unknown>"
0.03673 Panels data export found and set to 00007FFD1DE8CB80
0.03680 DLL Loaded: Path="Gauges\Fury_1500.dll" Version="4.3.29.25520"
0.03782 Panels data export found and set to 00007FFD1DE8CB80
0.03786 DLL Loaded: Path="Gauges\F-16.dll" Version="4.3.29.25520"
0.03897 DLL Loaded: Path="SimObjects\Modules\Driver.dll" Version="<Unknown>"
0.04000 DLL Loaded: Path="SimObjects\Modules\Orion MPCV.dll" Version="<Unknown>"
0.04104 DLL Loaded: Path="SimObjects\Modules\SLS Block 1.dll" Version="<Unknown>"
> 67.57963 [64, 1]Open: Version=0x00000004 Name="Throttle Control"
> 71.31276 [64, 2]AddToDataDefinition:DefineID=0, DatumName="GENERAL ENG THROTTLE LEVER POSITION:1", UnitsName="percent", DatumType=4, fEpsilon=0.000000, DatumID=-1
> 71.31423 [64, 3]SubscribeToSystemEvent:EventID=0, SystemEventName="SimStart"
> 71.31498 [64, 4]MapClientEventToSimEvent:EventID=1, EventName=""
> 71.31553 [64, 5]MapClientEventToSimEvent:EventID=2, EventName=""
> 71.31606 [64, 6]MapInputEventToClientEvent:GroupID=0, szInputDefinition="1", DownEventID=1, DownValue=0, UpEventID=-1, UpValue=0, bMaskable=0
> 71.31651 [64, 7]MapInputEventToClientEvent:GroupID=0, szInputDefinition="2", DownEventID=2, DownValue=0, UpEventID=-1, UpValue=0, bMaskable=0
> 71.31732 [64, 8]SetInputGroupState:GroupID=0, dwState=0
> 71.31801 [64, 9]AddClientEventToNotificationGroup:GroupID=0, EventID=1, bMaskable=0
> 71.31838 [64, 10]AddClientEventToNotificationGroup:GroupID=0, EventID=2, bMaskable=0
> 71.31877 [64, 11]SetNotificationGroupPriority:GroupID=0, uPriority=1

User avatar
WarpD
Posts: 1311
Joined: Mon Feb 14, 2011 5:29 am

Re: MyDispatchProcTC called only once.

Postby WarpD » Tue Sep 25, 2018 8:24 pm

I do not think you should be using the FSX SimConnect with v4 of Prepar3D. That exists only for software that was written to work way back when the SimConnect was the FSX version. Since you are writing for a 64-bit version of Prepar3D, I believe you should be using the 64-bit version of SimConnect as well.
Ed Wilson
Senior Developer
Mindstar Aviation

lvedin
Posts: 22
Joined: Wed Aug 01, 2018 6:58 am

Re: MyDispatchProcTC called only once.

Postby lvedin » Tue Sep 25, 2018 9:13 pm

Thank's
So what version of SimConnect.lib and dll shell I use ?
I found following in PD3:
ESPv1
FSX-RTM (Flight Simulator X)
FSX-RTM-JPN (Flight Simulator X, Japanese)
FSX-SP1 (Flight Simulator X: Service Pack 1)
FSX-SP1-RUS (Flight Simulator X: Service Pack 1, Russian)
FSX-SP2-XPACK (Flight Simulator X: Service Pack 2 with Expansion)

regarding 64-bit it failed somehow in other Windows API, but I will look into this if another correct SimConnect is available.

reagards Lennart Vedin

obinder
Posts: 63
Joined: Sun Jun 08, 2014 9:43 am

Re: MyDispatchProcTC called only once.

Postby obinder » Tue Sep 25, 2018 9:16 pm

Thank's
So what version of SimConnect.lib and dll shell I use ?
I found following in PD3:
ESPv1
FSX-RTM (Flight Simulator X)
FSX-RTM-JPN (Flight Simulator X, Japanese)
FSX-SP1 (Flight Simulator X: Service Pack 1)
FSX-SP1-RUS (Flight Simulator X: Service Pack 1, Russian)
FSX-SP2-XPACK (Flight Simulator X: Service Pack 2 with Expansion)

regarding 64-bit it failed somehow in other Windows API, but I will look into this if another correct SimConnect is available.

reagards Lennart Vedin

None of them. The libraries are here:
C:\Program Files\Lockheed Martin\Prepar3D v4 SDK 4.3.29.25520\inc
C:\Program Files\Lockheed Martin\Prepar3D v4 SDK 4.3.29.25520\lib

And all the samples are here:
C:\Program Files\Lockheed Martin\Prepar3D v4 SDK 4.3.29.25520\SimConnect

Best regards
Oliver Binder
Lorby-SI

lvedin
Posts: 22
Joined: Wed Aug 01, 2018 6:58 am

Re: MyDispatchProcTC called only once.

Postby lvedin » Tue Sep 25, 2018 9:19 pm

Thank's a lot, this give me hope !
I will try this tomorrow.

lvedin
Posts: 22
Joined: Wed Aug 01, 2018 6:58 am

Re: MyDispatchProcTC called only once.

Postby lvedin » Wed Sep 26, 2018 5:34 am

The folder Prepar3D v4 SDK 4.3.29.25520 and files is not on my disk searching all C: . Is the SDK installed separate or is this two files available anyhow ?

I selected Install P3D under C:\Prepar3Dv4 due to PMDG's recommendation, as I also know general issues when install under "Program Files". I think all should have been installed under C:\Prepar3Dv4 anyway. Or shall I reinstall P3D default location ?

regards Lennart Vedin

obinder
Posts: 63
Joined: Sun Jun 08, 2014 9:43 am

Re: MyDispatchProcTC called only once.

Postby obinder » Wed Sep 26, 2018 8:50 am

The folder Prepar3D v4 SDK 4.3.29.25520 and files is not on my disk searching all C: . Is the SDK installed separate or is this two files available anyhow ?

I selected Install P3D under C:\Prepar3Dv4 due to PMDG's recommendation, as I also know general issues when install under "Program Files". I think all should have been installed under C:\Prepar3Dv4 anyway. Or shall I reinstall P3D default location ?

regards Lennart Vedin
The SDK is a separate download, it is not part of the simulator itself.

You will find it in your user account or here: http://www.prepar3d.com/support/sdk/

Best regards
Oliver Binder
Lorby-SI

lvedin
Posts: 22
Joined: Wed Aug 01, 2018 6:58 am

Re: MyDispatchProcTC called only once.

Postby lvedin » Wed Sep 26, 2018 8:51 pm

Thank's a lot so far.

But the behavior is exactly the same, Callback work only once.

SimConnect.h is uppdated. I confirmed the lib is updated since I now was required to build as 64-bit.

The SimConnect.dll is put in my source as i suppose VS search first under my source for the dll. I don't even know if the dll is used since i use a lib, maybe the lib open the dll. But I can run the app without the dll in my source as well.

obinder
Posts: 63
Joined: Sun Jun 08, 2014 9:43 am

Re: MyDispatchProcTC called only once.

Postby obinder » Wed Sep 26, 2018 9:33 pm

Thank's a lot so far.

But the behavior is exactly the same, Callback work only once.

SimConnect.h is uppdated. I confirmed the lib is updated since I now was required to build as 64-bit.

The SimConnect.dll is put in my source as i suppose VS search first under my source for the dll. I don't even know if the dll is used since i use a lib, maybe the lib open the dll. But I can run the app without the dll in my source as well.
Works just fine for me. I have just now opened the "SimConnect Samples.sln" solution directly from the SDK, let VC2017 convert the C++ stuff to the new toolset, and then ran ThrottleControl in debug mode - works as designed. I don't think that the DLL is even required btw. The only thing that is odd is that they didn't catch the "Sim open" event, and you end up in the "default" branch initially. So I have added it for completeness sakes. Otherwise the input group isn't activated if the SimStart event isn't fired (=when connecting to the running sim).
case SIMCONNECT_RECV_ID_QUIT:
{
quit = 1;
break;
}

case SIMCONNECT_RECV_ID_OPEN:
{
hr = SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_THROTTLE, DEFINITION_THROTTLE, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_ONCE);
break;
}

default:
printf("\nReceived:%d",pData->dwID);
break;
}
Best regards
Oliver Binder
Lorby-SI

lvedin
Posts: 22
Joined: Wed Aug 01, 2018 6:58 am

Re: MyDispatchProcTC called only once.

Postby lvedin » Thu Sep 27, 2018 5:46 am

let VC2017 convert the C++ stuff to the new toolset
Maybe this is the issue, the VC Community does not have the "toolset 2015 v140" as written in P3D document and I don't know how to let VC convert toolset, I have 2017 v141. Else you give some good information. I'll add your completeness :)

regards Lennart Vedin.

lvedin
Posts: 22
Joined: Wed Aug 01, 2018 6:58 am

Re: MyDispatchProcTC called only once.

Postby lvedin » Sat Sep 29, 2018 9:50 am

I think the problem is solved. Don't know why I did struggle so much with SimConnect, I know FCUIPC is available for P3D. When installed, then my 10 years old FCUIPC applications works in first shot due to the interface is compatible all windows and all versions of all compilers for Windows. Free as well.

User avatar
WarpD
Posts: 1311
Joined: Mon Feb 14, 2011 5:29 am

Re: MyDispatchProcTC called only once.

Postby WarpD » Sat Sep 29, 2018 3:13 pm

Did you even try to get any of the samples to actually work? FSUIPC is not the best approach, in my opinion. If for any reason FSUIPC ceases production, you will not be able to proceed further in versions.
Ed Wilson
Senior Developer
Mindstar Aviation

lvedin
Posts: 22
Joined: Wed Aug 01, 2018 6:58 am

Re: MyDispatchProcTC called only once.

Postby lvedin » Sat Sep 29, 2018 10:03 pm

WarpD Thank you for your input and concern !

I'm not sure how FCUIPC interface internal to P3D, maybe use SimConnect... Pete intend to use a flightsim's official interface as with MSFS. If my FSUIPC app stop working due to new P3D version, it may mean all SimConnect apps, such as vPilot stop working.

The thing is I spent 20 hours for SimConnect and still I don't even know what more to try. Those who just test a SimConnect sample and got is to work, it's of cause one good chose. I just want a few custom controls and FSUIPC suite me also in the approach. I'm not a fan of Visual Studio for this projects with libraries and dll's that only are available for specific compiler.

Regard Lennart Vedin

obinder
Posts: 63
Joined: Sun Jun 08, 2014 9:43 am

Re: MyDispatchProcTC called only once.

Postby obinder » Sun Sep 30, 2018 1:08 pm

WarpD Thank you for your input and concern !

I'm not sure how FCUIPC interface internal to P3D, maybe use SimConnect... Pete intend to use a flightsim's official interface as with MSFS. If my FSUIPC app stop working due to new P3D version, it may mean all SimConnect apps, such as vPilot stop working.

The thing is I spent 20 hours for SimConnect and still I don't even know what more to try. Those who just test a SimConnect sample and got is to work, it's of cause one good chose. I just want a few custom controls and FSUIPC suite me also in the approach. I'm not a fan of Visual Studio for this projects with libraries and dll's that only are available for specific compiler.

Regard Lennart Vedin
Hi,

in fact, FSUIPC breaks with every new version of P3D, and all programs relying on it stop working - until Pete makes a new version. It has been the same procedure with every P3D release to date (major and point). FSUIPC is probably accessing the data segment of the running simulator (hence the term "offsets"?), so it needs to be at least recompiled for every new sim version.
SimConnect just keeps working, because it is the Simulators own built-in API. Lockheed usually takes care to keep it backwards compatible.

I have been using SimConnect for several years now, with VS 2013 Express, 2015 and 2017 Professional, both for C++ and C# projects without any problems.

Be mindful that the Throttle example has a bug, as described above.

Best regards
Oliver Binder
Lorby-SI

lvedin
Posts: 22
Joined: Wed Aug 01, 2018 6:58 am

Re: MyDispatchProcTC called only once.

Postby lvedin » Mon Oct 01, 2018 5:59 pm

You may read what Pete write himself https://forum.simflight.com/topic/86056 ... -with-p3d/

My very standard FSUIPC interfacing will work as long as SimConnect P3D is backward compatible.

What worry me more is SimConnect state: "Ensure the Platform Toolset (Configuration Properties, General) is set to Visual Studio 2015 (v140)." A red flag come up when an interface require, first a specific compiler, then even a specific Toolset whatever it is.

I also doubt all my issues is a bug in Throttle sample, since everything I did try end up in same result, worked once only.

regards Lennart Vedin


Return to “SimConnect Interface Questions”

Who is online

Users browsing this forum: No registered users and 16 guests