SimConnect_ClearInputGroup() not working?

The SimConnect_ClearInputGroup() is reported to be working, but I can’t get it
to work properly, nor I can find a way to stop intercepting events. Attached
here is the code I’m using, slightly modified from the InputEvent.cpp sample
in the SDK. In this
case, I mapped the “a” key to a custom event. This WORKS, I press A in the
sim, and the event happens. However, as soon as I receive the event, I wanted
to turn it off, but none of the following seems to work:

SimConnect_SetInputGroupState(hSimConnect, INPUT0, SIMCONNECT_STATE_OFF);

This one is the only one that doesn’t result in an exception error. However,
it doesn’t do anything, the key is continuing to fire the event. I tried all
the following:

hr = SimConnect_ClearNotificationGroup(hSimConnect, GROUP0);
hr = SimConnect_ClearInputGroup(hSimConnect, INPUT0);
hr = SimConnect_RemoveClientEvent(hSimConnect, GROUP0, EVENT_1);
hr = SimConnect_RemoveInputEvent(hSimConnect, INPUT0, "z");

All of them returns various unrecognized id exceptions, and the event continue
to fire. In addition to that, it seems that event notifications persist even
after closing the Simconnect Client .EXE that requested them, meaning if I
quit the application and start it again while the sim was continuing to run,
the 2nd time the application runs, it gets 2 event notifications for each key,
the 3rd time it gets 3 events notifications, the 4th time 4, and so on. Could
you please have a look at the attached code and see if I did something wrong,
or there is in fact an issue with clearing or just disabling input or
notification groups ?

Here’s a video showing the problem: not only it doesn’t seem possible to clear
an input group while the client application is running, but even when the app
quits and it’s restarted, the sim is remembering all notifications from the
previous session, resulting in triggering one more event for the same key each
time the external app is restarted. This will cause countless of issues with
apps, progressively messing up with the sim, until the sim itself is
restarted. Here’s the problem in MSFS: And here the SAME source code,
just compiled with the P3D Simconnect and running with P3D
, working as
expected: the event is triggered only ONCE, and never again after the input
group state is turned off. And, restarting the application won’t caused the
cascading events.

Bumping this only to report the bug is still present with SU9. I hope this
will be looked at, because all these functions calls are documented as
“working”, but the inability to turn off input groups notifications when they
are not required anymore will surely have some impact on the whole sim, both
because some apps might break since they will continue to get notifications
even after they assumed to have them turned off, but also because past
notifications survive even after restarting the client app, causing
duplications of notifications each time the app is restarted, with no recourse
other than restarting the sim.

Hi, Indeed, there is an issue with disabling. About Clearing, this is half an
issue, half an api choice. By using SimConnect_ClearNotificationGroup, you
delete the group but dependencies remain (Events added with
SimConnect_AddClientEventToNotificationGroup) then you try to remove them
using SimConnect_RemoveClientEvent but the notification group is already
destroyed. For now, here is the order you should clear:

  1. SimConnect_RemoveClientEvent
  2. SimConnect_RemoveInputEvent

We’ll fix disabling and change the way how cleaning works, so removing
notification group or input group will also remove their dependencies Best
Regards Maxime / Asobo Thank you for your
answer so, if I understood correctly, the SimConnect_SetInputGroupState call
is not able to disable an input group, so it needs a fix, but I could achieve
the same results by calling the other APIs in the correct order ? I tried
that, and it results in a couple of Exceptions 3, see the attached code.

Hi, Right now (SU9), SimConnect_SetInputGroupState(…, SIMCONNECT_STATE_OFF)
doesn t work but will be fixed (SU10). I misspoke about clearing. Here is a
small definition about each clearing function: SimConnect_RemoveClientEvent:
Remove EventId from GroupId and delete it. If GroupId has no event linked to
him after that, it will be deleted too. SimConnect_ClearNotificationGroup:
Delete GroupId and its dependencies (eventIds). Right now (SU9), GroupId is
deleted but its dependencies remain. Will be fixed on SU10 Same idea for
SimConnect_ClearInputGroup and SimConnect_RemoveInputEvent. In your case, you
can just use SimConnect_RemoveClientEvent and SimConnect_RemoveInputEvent
(because you only have one event/input). The exception you got is the result
of using SimConnect_ClearNotificationGroup/SimConnect_ClearInputGroup after
using SimConnect_RemoveClientEvent/SimConnect_RemoveInputEvent which has
destroyed it. Best Regards Maxime / Asobo