Hi All,
I would like to map 0,1,..9 keystroke in a Simconnect application. Although the following code works :
I was thinking to do something more concise in the following way :
where num and eve will be the string "0", EVENT_O ; "1", EVENT_1 ; and so on...
However it doesn't work because num and eve are not replace by there values in the SimConnect arguments....
Does anybody know if it's possible to do it the way I was thinking ?
Thanks.
I would like to map 0,1,..9 keystroke in a Simconnect application. Although the following code works :
Code:
hr = SimConnect_MapClientEventToSimEvent(NewSimConnect, EVENT_0);
hr = SimConnect_MapInputEventToClientEvent(NewSimConnect, INPUT_NUM, "0", EVENT_0);
hr = SimConnect_AddClientEventToNotificationGroup(NewSimConnect, GROUP_NUM, EVENT_0);
//
hr = SimConnect_MapClientEventToSimEvent(NewSimConnect, EVENT_1);
hr = SimConnect_MapInputEventToClientEvent(NewSimConnect, INPUT_NUM, "1", EVENT_1);
hr = SimConnect_AddClientEventToNotificationGroup(NewSimConnect, GROUP_NUM, EVENT_1);
//
and so on...
I was thinking to do something more concise in the following way :
Code:
char* num = (char*)malloc(4 * sizeof(char));
char* eve = (char*)malloc(8 * sizeof(char));
for(int n=0; n<=9; n++) {
sprintf(num, "\"%1d\"", n);
sprintf(eve, "EVENT_%1d", n);
hr = SimConnect_MapClientEventToSimEvent(NewSimConnect, eve);
hr = SimConnect_MapInputEventToClientEvent(NewSimConnect, INPUT_NUM, num, eve);
hr = SimConnect_AddClientEventToNotificationGroup(NewSimConnect, GROUP_NUM, eve);
}
However it doesn't work because num and eve are not replace by there values in the SimConnect arguments....
Does anybody know if it's possible to do it the way I was thinking ?
Thanks.

