You tagged your question as C++ and C#. So I will give only a general answer.
While there are many methods for IPC (Inter Process Communication) it looks like using Windows messages is appropriate here.
To use this the sender must know which message to be send to which window handle. The common method is to define a message and implement the handling in the main window of the receiving application. That handler can then initiate further actions like closing the menu.
To send a message you can use the
SendMessage function (Windows)[
^] or the
PostMessage function (Windows)[
^]. But you must know the window handle of the receiving application that handles the message. You can get that by using the
FindWindow function (Windows)[
^] with a registered window class name and/or title. Alternatively use the
BroadcastSystemMessage function (Windows)[
^] to send the message to all applications (recipient
BSM_APPLICATIONS
and flag
BSF_IGNORECURRENTTASK
). Then you don't need a window handle but should ensure that the message is unique (see below).
For the message you can use a
WMP_APP
based identifier (
WM_USER
is not recommended). A better solution would be using a registered message that ensures a unique identifier (see
RegisterWindowMessage function (Windows)[
^]). See also
About Messages and Message Queues (Windows)[
^].
All the above functions can be also used with C# by using P/Invoke.