Use chotkeyctrl to add a hotkey for the program to hide the display on the main interface, similar to the boss key. The specific operations are as follows:
1. Obtain the set hotkey and use registerhotkey to register the hotkey. The Code is as follows:
// Obtain the hot key value chotkeyctrl * photk = (chotkeyctrl *) getdlgitem (idc_hotkey1); Word vkey, fsmoderfiers; photk-> gethotkey (vkey, fsmoderfiers ); // register the hotkey bool r = registerhotkey (m_hwnd, 111, fsmoderfiers, vkey); // judge the registration result
Second, add the wm_hotkey message to receive the response hotkey message. The Code is as follows:
Void ctestdlg: onhotkey (uint nhotkeyid, uint nkey1, uint nkey2) {// if multiple hotkeys are registered, you can use the switch statement to process static bool flag = false; if (nhotkeyid = 111) {// hide the display window showwindow (FLAG); flag =! Flag;} cdialog: onhotkey (nhotkeyid, nkey1, nkey2 );}