- Messages
- 1,243
- Country
I am trying to make the Throttle Control C++ example into a managed example in C#.
Almost got it except for:
This give me an exception =1 UnKNOWN.
From the SDK
Parameters
hSimConnect
[in] Handle to a SimConnect object.
GroupID
[in] Specifies the ID of the client defined input group that the input event is to be added to.
pszInputDefinition
[in] Pointer to a null-terminated string containing the definition of the input events (keyboard keys, mouse or joystick events, for example). See the Remarks and example below for a range of possibilities.
DownEventID
[in] Specifies the ID of the down, and default, event. This is the client defined event that is triggered when the input event occurs. If only an up event is required, set this to SIMCONNECT_UNUSED.
DownValue
[in, optional] Specifies an optional numeric value, which will be returned when the down event occurs. This value is only acknowledged for keyboard and button events.
UpEventID
[in, optional] Specifies the ID of the up event. This is the client defined event that is triggered when the up action occurs.
UpValue
[in, optional] Specifies an optional numeric value, which will be returned when the up event occurs. This value is only acknowledged for keyboard and button events.
bMaskable
[in, optional] If set to true, specifies that the client will mask the event, and no other lower priority clients will receive it. The default is false.
The SDK documentation says to make the DownEventID should be SIMCONNECT_UNUSED and in the non managed world it's (EVENT_ID)SimConnect.SIMCONNECT_UNUSED. This gives me a overflow error. So I set an EVENT_ID.EVENT_NOEVENT as the first enum in my events (Seen this on the google).
Does anyone know how to use SimConnect_MapInputEventToClientEvent in a non-managed program?
Almost got it except for:
Code:
simconnect.MapInputEventToClientEvent(INPUT_ID.INPUT_KEYS, "A", EVENT_ID.EVENT_A, (uint)1, EVENT_ID.EVENT_NOEVENT, (uint)1, false);
This give me an exception =1 UnKNOWN.
From the SDK
Code:
HRESULT SimConnect_MapInputEventToClientEvent(
HANDLE hSimConnect,
SIMCONNECT_INPUT_GROUP_ID GroupID,
const char* pszInputDefinition,
SIMCONNECT_CLIENT_EVENT_ID DownEventID,
DWORD DownValue = 0,
SIMCONNECT_CLIENT_EVENT_ID UpEventID =(SIMCONNECT_CLIENT_EVENT_ID)SIMCONNECT_UNUSED,
DWORD UpValue = 0,
BOOL bMaskable = FALSE
);
Parameters
hSimConnect
[in] Handle to a SimConnect object.
GroupID
[in] Specifies the ID of the client defined input group that the input event is to be added to.
pszInputDefinition
[in] Pointer to a null-terminated string containing the definition of the input events (keyboard keys, mouse or joystick events, for example). See the Remarks and example below for a range of possibilities.
DownEventID
[in] Specifies the ID of the down, and default, event. This is the client defined event that is triggered when the input event occurs. If only an up event is required, set this to SIMCONNECT_UNUSED.
DownValue
[in, optional] Specifies an optional numeric value, which will be returned when the down event occurs. This value is only acknowledged for keyboard and button events.
UpEventID
[in, optional] Specifies the ID of the up event. This is the client defined event that is triggered when the up action occurs.
UpValue
[in, optional] Specifies an optional numeric value, which will be returned when the up event occurs. This value is only acknowledged for keyboard and button events.
bMaskable
[in, optional] If set to true, specifies that the client will mask the event, and no other lower priority clients will receive it. The default is false.
The SDK documentation says to make the DownEventID should be SIMCONNECT_UNUSED and in the non managed world it's (EVENT_ID)SimConnect.SIMCONNECT_UNUSED. This gives me a overflow error. So I set an EVENT_ID.EVENT_NOEVENT as the first enum in my events (Seen this on the google).
Does anyone know how to use SimConnect_MapInputEventToClientEvent in a non-managed program?