After reading numerous posts from all over the web, I decided to spend my entire weekend trying to figure this out.Good news! I did!!! Thanks to the multitude of frustrated posters on this, and other forums.NOTE
: This post assumes... (1) you have experience in Delphi and (2) have done work with SimConnect within Delphi before, but are just having difficulty getting SimConnect and Delphi XE2 to play nice together.1. Start by downloading the latest Delphi SimConnect files from C. Scott Hendry's web site (this is the latest FSX SimConnect):http://members.iinet...her/Delphi2.zip
2. Following these instructions in editing the SimConnect.pas file to support AnsiChars and AnsiStrings:http://www.fsdevelop...52&postcount=11
This is where everyone starts to lose ground because although you might be able to compile/build you FSX project, either the connection to the SimConnect.dll file fails OR
calls to the SimConnect.dll file cause exceptions errors every time. Hang tight, we're almost there!
3. I had to do this to make sure I got a connection with worrying about my Windows 7 path, or executable/project path where my application was running from. COPY the latest "SimConnect.dll" file on your machine to your project folder or where your application (exe or DLL) will run from. You guys can work out alterative locations later, but I was too excited to get this posted to worry about this step. (Please share your insight into NOT having to copy the DLL; I tried to place it into a global/Win7 path and it didn't work
)Anyway, to find the latest DLL on Windows 7 Pro (x64) check the following location which is where I installed the SDK: (it may be installed in a different location on your PC
C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X SDK\SDK\Core Utilities Kit\SimConnect SDK\lib\managed
4. Here is the big one... there is a file inside C. Scott Hendry's zip file (downloaded frome #1 above
), under the folder "Delphi\HeaderRT
" folder called "SimConnect.Pas.embed.manifest
". You will need to override your project's Run-Time Theme (the what? exactly!) with this predefined manifest. To do that in Delphi XE2 you need to do the following:- Delphi menu path: Project -> Options
- In the options window click on the item in the navigation tree called "Application
"- On the Application settings panel (on the right) you we see "Runtime Themes
". When you first see that it is likely set to "Enable runtime themes
". Change it to "Use custom manifest
".- After changing the runtime theme setting, select the manifest file "SimConnect.Pas.embed.manifest
" mentioned above by clicking the open file dialog box using the elipsis button [...] next to the Custom Manifest edit box and navigating to the file, wherever you unzipped it to.- Once selected and the file appears it the "Custom Manifest" edit box, click "OK"- Resave your projectNow you're ready to Build and Run your project under Delphi XE2.*** Sorry, I'm not sure if/how/where this may / may not work in other versions of Delphi ***
Another tip to make sure you're FSX/Delphi projects are consistently compiled... always add the following lines to "uses" clause in your main Project "program" code file (under Project -> View Source):
SimConnectSupport in '<your specific path>\HeaderRT\SimConnectSupport.pas',SimConnect in '<your specific path>\HeaderRT\SimConnect.pas'
Then, as usual, make sure you include these units in your "uses" clause in your main program units (where needed) for SimConnect function and constant / variable references.This just solves the environmental issues between SimConnect and Delphi XE2 causing people to not be able to build their FSX applications, or properly connect to the SimConnect.dll.... and those are the biggest hurdles people have been facing for a few years. Now, you may still have your own specific implementation / function call issues. There are other posts that can help you with those.This should work for you. Read thoroughly and carefully, apply your already established knowledge of these tools and it will all work out fine.