I want to click a entry in the ALT-menu and then it should close the menu and switch to that funktion.
For example: There is a entry in ALT-menu "Show GPS INFO". If you click that entry the ALT-menu should be closed and all Infos should be displayed outside of the ALT-menu
Using exit_alt() or gui_kbd_leave() in gui.c or other functions will crash after a few seconds.
Even the attempt to simulate a key press within a function like kbd_key_press (KEY_PRINT) does not close the ALT - menu.
Well, you are in the right area in the code. Off the top of my head, it might be something to do with which task you have inserted your code into. Calling these functions from the wrong task could mix up the keyboard task.
What about setting a global flag in your code and then hacking kbd.c so that it sees it and assumes the "ALT" key has been set ? Ugly but you are doing a "one off" in any case.
(reyalp will probably have a better idea here ...)