Newbie question about how to set a variable in the sim

I’ve written a simple project in C# that should be fairly easy to convert to C++.

https://forums.flightsimulator.com/t/using-the-simconnect-sdk-a-simvar-request-handler