A button box, a Stream Deck helper, a checklist that sets things for you. They all come down to the same thing: sending a key event to the sim.
Use the project file from the 2020 SimConnect starter.
Three controls in one go
using Microsoft.FlightSimulator.SimConnect;
using var ready = new EventWaitHandle(false, EventResetMode.AutoReset);
using var sim = new SimConnect("Button box", IntPtr.Zero, 0, ready, 0);
sim.MapClientEventToSimEvent(Ev.ParkingBrake, "PARKING_BRAKES");
sim.MapClientEventToSimEvent(Ev.HeadingBug, "HEADING_BUG_SET");
sim.MapClientEventToSimEvent(Ev.Squawk, "XPNDR_SET");
void Send(Ev ev, uint value = 0) =>
sim.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, ev, value, Group.Highest, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);
// The transponder wants BCD: each digit of the code gets its own four bits, so 1200 is sent as 0x1200.
static uint Bcd(string code) => Convert.ToUInt32(code, 16);
Send(Ev.ParkingBrake);
Send(Ev.HeadingBug, 270);
Send(Ev.Squawk, Bcd("1200"));
enum Ev { ParkingBrake, HeadingBug, Squawk }
enum Group : uint { Highest = 1 }
Load a flight, run it, and look at the cockpit. The parking brake should flip, the heading bug should move to 270 and the transponder should show 1200.
