How can I assign a custom function to a system command for my program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I assign a custom function to a system command for my program?

I have an Airline reservation Program and it has lots of menus and sub menus... Now, I wished to have a system command like Alt+F4 or Ctrl + M to return to the main menu in my program, from wherever the user may be in the program at that time... So, by pressing Ctrl+M or something like this, I wished to transfer my program to execution of the main menu function again, even when the user is filling details etc. (I save data only in the end). How can I achieve this ? Please Help!

2nd Jun 2017, 1:25 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
3 Answers
+ 3
Also note that I cannot use external headers in this program, so please tell me how to do this using windows.h only... Thank You for your efforts
2nd Jun 2017, 1:30 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
Okay, now how do you combine keys? And, will this execute the menu function from the start everytime I press Ctrl? if(GetKeyState(VK_LCONTROL)) Menu();
2nd Jun 2017, 3:48 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
Let me introduce you GetKeyState() Doc: https://msdn.microsoft.com/es-es/library/windows/desktop/ms646301(v=vs.85).aspx
2nd Jun 2017, 1:42 PM
Madera Oxidada
Madera Oxidada - avatar