October 13, 201015 yr Hello SimConnect gurus, I'm using VS2005 and C++ to create a program and now I want to add functionality to connect to Microsoft Flight Simulator X. To do this, I want to load the required DLL (SimConnect.dll) in runtime. There is one very important requirement: the program MUST also be able to run, when the SimConnect DLL is NOT present on the PC (many existing users of my program don't have FSX). Off course, the program should report the absence (when necessary) and exit gracefully... I have read that the SimConnect DLL was setup as a side-by-side assembly; I know I must do something with it's manifest to get the program to work. I have read a whole bunch of information on manifests and such, but I'm not sure how to implement it. As a small test, I have just included the header file for SimConnect in my code and 'programmed' a LoadLibrary call, to load the DLL. On my development-system that works: the DLL loads. On a second PC however (where FSX is not installed), I get the message that 'The program is not installed correctly...' and the program does not start at all (even when the LoadLibrary function is not called ...). How can I solve this? Should the header-file be modified or is there another (more elegant?) way? Thanks in advance. BTW: The program does not use .NET and has an embedded manifest which is generated automatically.
October 15, 201015 yr Did you add a reference to the simconnect.lib file as explained in the simconnect sdk documentation? If so, then the DLL will be linked statically. If you want to load the library dynamically, you should not add the .lib file to the project.Daniel
October 15, 201015 yr Author Did you add a reference to the simconnect.lib file as explained in the simconnect sdk documentation? If so, then the DLL will be linked statically. If you want to load the library dynamically, you should not add the .lib file to the project.DanielHello Daniel,Thanks for your reply. I have also posted this question at the MSDN C++ forum (here) and received an answer that comes down to this:Exclude the manifest from the SimConnect DLL from the manifest of the program (using '#define SIMCONNECT_H_NOMANIFEST' before including simconnect.h); Include the manifest in the .EXE as a resource, with an ID greater than 100 (using a post-build script: mt.exe -manifest "$(InputDir)SCServer.manifest" -outputresource:"$(OutDir)\$(TargetFileName)";^#101) Activating the DLL-manifest, just before calling LoadLibrary (with the Windows functions found here). I haven't completely finished my code, but the manifest-part and loading the SimConnect DLL works!BTW: Later I found this post with answers from Pete Dowson (here). I didn't understand the post earlier, but now it makes sense...
Create an account or sign in to comment