The SimConnect_RequestSystemState function is used to request information from a number of Microsoft Flight Simulator system components.

 

Syntax
HRESULT SimConnect_RequestSystemState(
    HANDLE  hSimConnect,
    SIMCONNECT_DATA_REQUEST_ID  RequestID,
    const char*  szState,
    );

 

Parameters
ParameterDescriptionType
hSimConnectHandle to a SimConnect object.Integer
RequestIDThe client defined request ID.Integer
szStateA null-terminated string identifying the system function. One from the table shown below.String

 

The following table shows the values available for the szState:

StringDescription
AircraftLoadedRequests the full path name of the last loaded aircraft flight dynamics file. These files have a .AIR extension.
DialogModeRequests whether the simulation is in Dialog mode or not.
FlightLoadedRequests the full path name of the last loaded flight. Flight files have the extension .FLT.
FlightPlanRequests the full path name of the active flight plan. An empty string will be returned if there is no active flight plan.
SimRequests the state of the simulation. If 1 is returned, the user is in control of the aircraft, if 0 is returned, the user is navigating the UI. This is the same state that notifications can be subscribed to with the “SimStart” and “SimStop” string with the SimConnect_SubscribeToSystemEvent function.

 

Return Values

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return valueDescription
S_OKThe function succeeded.
E_FAILThe function failed.

 

Remarks

It is important to call this function sufficiently frequently that the queue of information received from the server is processed. If there are no messages in the queue, the \[dwID\] parameter will be set to SIMCONNECT_RECV_ID_NULL.