SimConnect functions error "too many arguments" and 737NGX does not respond to Data Change Events

Hello Simmers and Developers.
After 2 years im now back in the flight simulation world. And I try now to build my own "small" homecockpit for my favourite aircraft the PMDG 737NGX. After searching for SDK for the NGX i found out really fast that the PMDG delivers SDK. So I downloaded Visual Studio 2013, because I have read that SimConnect only works up to this version of IDE) and installed on my PC. As well i put my Disk 1 vom my FSK Gold Edition in my PC and install the SDK for the FSX. As installpath i used my external hard drive for my fsx.

Then i started Visual Studio and creating an new Win32 Console Application, with pre compiled headers. A quick "Hello World" cout test code works fine so now to the SimConnect SDK.

That is what I did to link to my SimConnect files/dll/library:
1) Unter Project / Properties / C/C++ Linker I add the SimConnect Header File(SDK/Core .../SimConnect SDK/inc)
2) Now under Linker / General I add the Additional Library to the SimConnect Library File(SimConnect SDK/lib)
3) Linker / Input I add the SimConnect.lib under Additional Dependencies
And I add unter the command line in the Linker Section "/INCREMENTAL" to get rid of one warning.

Then i import the PMDG Test Connection cpp file to my project after compiling I good same errors. Most of them are "undeclared identifier" and "function does not take 6 arguments".

That are the lines with errors:

Code:
        // Define the data area structure - this is a required step
        hr = SimConnect_AddToClientDataDefinition(hSimConnect, PMDG_NGX_DATA_DEFINITION, 0, sizeof(PMDG_NGX_Data), 0, 0);

        // Sign up for notification of data change.  
        // SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_CHANGED flag asks for the data to be sent only when some of the data is changed.
        hr = SimConnect_RequestClientData(hSimConnect, PMDG_NGX_DATA_ID, DATA_REQUEST, PMDG_NGX_DATA_DEFINITION,
            SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_CHANGED, 0, 0, 0);

        // Define the control area structure - this is a required step
        hr = SimConnect_AddToClientDataDefinition(hSimConnect, PMDG_NGX_CONTROL_DEFINITION, 0, sizeof(PMDG_NGX_Control), 0, 0);

        // Sign up for notification of control change.  
        hr = SimConnect_RequestClientData(hSimConnect, PMDG_NGX_CONTROL_ID, CONTROL_REQUEST, PMDG_NGX_CONTROL_DEFINITION,
            SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_CHANGED, 0, 0, 0);
Undeclared identifier joins on "SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET" and "SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_CHANGED". And on the functions "SimConnect_AddToClientDataDefinition" the last zero is underlined red. After same reseraching on the Internet I found a post on this Forum to solve this problem, but not for me!

The lines with the addtoclientdatadefinition changes to this:

Code:
hr = SimConnect_AddToClientDataDefinition (hSimConnect, PMDG_NGX_DATA_DEFINITION, 0, 0, 0);
hr = SimConnect_AddToClientDataDefinition (hSimConnect, PMDG_NGX_CONTROL_DEFINITION, 0, 0, 0);
And the two lines with the too many arguments changes to this:
Code:
hr = SimConnect_RequestClientData(hSimConnect, PMDG_NGX_DATA_ID, DATA_REQUEST, PMDG_NGX_DATA_DEFINITION, 0, 0);
Now i can compile my Project and run it. When i stand with the 737NGX on a airport and run the application then i got an message that says that the program successfully connected to FS. Followed by this 5 messages on the console:

Code:
Connected to Flight Simulator!
Received:2
Received:1
Received:1
Received:1
Received:1
Every thing is good. I press the keys that are programmed like(Ctrl+Shift+B) is in this example to turn on the Logo Light works fine!

But the NGX does not respond to any Data Change Events. Example an Message in Console should came if I switch the taxi light, but the message never cames. Also if I switch the Fuelpump switchs no messages. So i think there is samething wrong with the changed Code lines, that gives me the errors with too many arguments and undeclared identifier. When I add an debug message with printf in the "ProcessNGXData()" function this debug message will never display on the console.

So now what is wrong?

Has samebody else this problem too? And know how to fix it?

Good evening, Jan
 
EDIT: I have install now the SDK from the Acceleration Pack, now the normal function like in the connection test file is usable without editing!
But now when I try to compile my project I get two Link Errors:

Code:
 LNK2019: unresolved external symbol _SimConnect_AddToClientDataDefinition@24 referenced in function "void __cdecl testCommunication(void)" (?testCommunication@@YAXXZ)
error LNK2019: unresolved external symbol _SimConnect_RequestClientData@36 referenced in function "void __cdecl testCommunication(void)" (?testCommunication@@YAXXZ)
error LNK1120: 2 unresolved externals
Maybe that is a problem with old files in SDK cause the reinstall of the new SDK, I try tomorrow to uninstall the SDK complete and install only the Acc SDK, and create a new Project.

Jan
 
Make certain you're linking the new SimConnect.lib as well.
Hello WarpD!

The SimConnect.lib file does not moved, with the installation of the Acc SDK. But maybe the file was corrupt or not replaced correctly.

So everything works fine. I uninstall the complete SDK from my PC, and install at first the RTM SDK from my Professional Disk 1 after that I put in my Acc Disk in and install the SP1a SDK. Finally then the Acc SDK, there I got a warning that another SDK is already installed and I can't install both versions on my PC, Acc SDK need to delete the old files. After that process my Acc SDK was installed.

In Visual Studio I create a complete empty(without precompiled headers) new project. And in the Linker I add the Librarys and SimConnect.lib file and on the C/C++ I add the include folder for the SimConnect Header file. But I copy the SimConnect Header file to my Visual Studio Project Folder and add in the SimConnect Header file the #includes Windows.h and iostream because basic commands like "DWORD" was unlined red after adding the includes lines to the file no errors. After importing the PMDG Connection Test File I get not compiling errors, and I run the application.

And now I tested it again, everything works. I get 2 messages instad of 5 when my application connected to FS:

Code:
Connected to Flight Simulator!
Received: 2
Maybe the other 4x Received:1 messages from the version before, are an indicator for something is not initialized correctly, but why the Visual Project before doesn't work I don't know. But now its working! :)

And now when I flip the AFT Fuelpump in the NGX I got my Message in the Console:

Code:
LOW PRESS LIGHT: [ON]
LOW PRESS LIGHT: [OFF]
Thanks for your help :)

Dear greetings from Germany.
Jan
 
Top