• 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.

MSFS Send keyboard commands from external app

Hi all
I try to write a app that use voice commands from mic . to control the MSFS
does any one know if I can use the C# SendMessage function or i have to connect using the SimConnect
dll .If yes I have no expirence in the SimConnect can some one show me the way ?
Regards Doron
Hi Doron,

You'll need to either use SimConnect or have your app drive a low-level input device/emulator like keyboard/mouse/joystick. In the latter case you'd be dependent on the control mappings set up in the simulator itself, but this may be a good thing, depending on your needs. Also to note that in some cases, depending on the MSFS "cockpit interaction system" option, the sim may not be getting hardware input events unless the main window has focus (SimConnect doesn't have this problem, though it certainly has its own share of others and is a learning curve all the way).

There are examples and other C# apps using SimConnect in various parts of the Internet for your searching enjoyment (one is pinned at the top of this forum). If you're asking for a personal tutorial... sorry, don't have that bandwidth now, but perhaps someone else does. Come back with specific questions if you have any.

Last edited:
Hi thanks for help . May be I mis understand your answer but the app simulate keyboard by sending keyboard key code
Hi thanks for help . May be I mis understand your answer but the app simulate keyboard by sending keyboard key code
Ah, you meant SendMessage() (probably PostMessage()) from user32.dll...? That could be worth a try, if the correct window handle can be found and it's listening for key events... I'd be mildly surprised, but maybe! You could also try to raise the sim window and SendInput() since that gives you the other modifiers besides ALT. Not sure how reliable all that would be, but perhaps enough for your needs. Sorry, can't give you a more definitive answer on that.

Hi thanks .
1) You are right I meant PostMessage
2) I try to open the VoiceAttack and from I read on the page they use the SimConnect to connect
Regard Doron
I will go ahead with SimConnect or FSUIPC ( have to learn the two option)
Well I got curious, and FWIW I tried it with SendInput(), and even though I see the exact same WM_ key messages being delivered to the sim window, the ones I actually type work but the ones I send programmatically do not. Which leads me to conclude it's not listening to those window events at all and is reading inputs some other way.

Screenshot from Spy++, I'm pressing LALT-L; First set of messages is me pressing the keys on the keyboard, the 2nd set (starting at the highlighted line) is sent via SendInput() from a test program.


Oh well! 🤷‍♂️
I usually don't send keyboard commands or controller commands directly to the sim from an external application. It’s easier to assign a function to a Sim’s variable in an external application and send the variable clearly, and at the same time you can make an interface with the ability to replace keyboard or controller button combinations, as well as assigned variables, up to custom ones "L;", "H;", "B;","K" ...
This was a test/concept (I write/maintain a macro launcher plugin and WASM add-on that does much of what you describe already). This was possible with <= FSX as far as I remember, but I was curious if they broke it in FS2020. Unfortunately there's a few controls here and there that no one seems to be able to figure out how to control remotely via SimConnect or WASM (Gauge API/calc code). Like TOGGLE FLASHLIGHT. Or the silly ATC menu, or active pause. But I did figure out a way to reliably focus the sim window (eg. so hardware-level inputs can be sent to it properly), so that's a minor benefit at least.

I try to use FSUIPC example and i see that the simulate KeyPress work using the dll so I have a solution to my question
Regards Doron