热键

#include <Windows.h>

int APIENTRY WinMain(HINSTANCE hinstance,HINSTANCE hpreinstance,LPSTR cmdline,int mcmdshow)
{
    RegisterHotKey(NULL, 0x001, MOD_CONTROL, '1');
    MSG msg;
    while (GetMessage(&msg,NULL,0,0))
    {
        if (msg.message == WM_HOTKEY)
        {
            MessageBoxA(0, "即将退出", "确定", 0);
            exit(0);
        }
    }
}
原文地址:https://www.cnblogs.com/xiaochi/p/5138750.html