• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

SimConnect - Accessing from VB

Send Commands to aircraft

Hi Russ,

I could connect to FSX using Simconnect, and I could get some usefull data to my homebuilt cockpit project. But now i'm experiencing problems to send commands to FSX aircraft, some like turn strobe light on, or set parking brakes.

I'm using Visual Basic 2008 Express Edition to develop the software.

Do you know how could I send commands to the aircraft?

Thank you,
 
Hi,

Thanks for the code examples.

I have a problem though where I need a word of advice. To make this work, I had to define the full path to simconnect.dll in the lib part of the declaration.

But I don't know what SP level another FSX installation might have. Further the location of simconnect.dll varies between 32 and 64 bit OS.

How can I make this work?

Note : to make these work, you'll have to place a copy of SimConnect.dll somewhere where VB can find it, or else specify the path to it directly in the Declare statement

I have seen this on my second reading of the Wiki, but it does not answer how to write something which could be distributed.
I am trying to find out if the lib part of the declare statement can be made variable during runtime. So far without positive results.
 
Last edited:
OK, I can answer my last post now.

The location of the simmconnect.dll on any given PC will differ depending on the OS (32 or 64 bit), depending on how the %WINDIR% folder is named and depending on the drive letter where the %WINDIR% folder is installed. The connection between VB6 and any DLL you are referring to via a statement like

Code:
Private Declare Function GetThreadLocale Lib "kernel32" () As Long

will be made during program start before the first line of your code is executed. If it is not found, the connection will not be made and can not be repaired later during program execution. You have no chance to tell your program the location of simconnect.dll during runtime.

The solution I have come up with is this:

What happens when a program with a reference to SimConnect starts is that it looks for simconnect.dll at these places in the given order:
  • Application folder
  • Current folder
  • %WinSys% folder
  • %Win% folder
  • %Path%

So in my code I check for the location of simconnect.dll, and before I use any call to it, I copy over simconnect.dll into my application directory, inform with a MsgBox that I have done so and that the program needs to be restarted and then close the program. On the next start simconnect.dll is located at a place where it can be found; in the program folder.

If you want to work clean, you should delete it after usage.
 
Last edited:
Back
Top