os_ icon

Media Key Test

os_ | PRO | 07/19/18 10:16:34 PM UTC | 0 ⭐ | 189 👁️ | Never ⏰ | []
C++ |

910 B

|

None

|

0 👍

/

0 👎

#include "stdafx.h"
#include "Windows.h"
#include <iostream>
#include <string>
using namespace std;
 
int _cdecl _tmain(int argc, TCHAR *argv[])
{
    for (int i = 0xB0; i <= 0xB3; i++)
        if (RegisterHotKey(NULL, 1, NULL, i))
            printf("Hotkey 0x%02X registered\n", i);
 
    int count = 0;
    MSG msg = { 0 };
    while (GetMessage(&msg, NULL, 0, 0)) {
        count++;
 
        char* name = (char*)malloc(5);
        switch (msg.lParam) {
            case 0xB00000: strcpy_s(name, 5, "FORW"); break;
            case 0xB10000: strcpy_s(name, 5, "BACK"); break;
            case 0xB20000: strcpy_s(name, 5, "STOP"); break;
            case 0xB30000: strcpy_s(name, 5, "PLAY"); break;
        }
 
        printf("==========================\n");
        printf("Count:   %d\n", count);
        printf("message: 0x%02X\n", msg.message);
        printf("wParam:  0x%02X\n", msg.wParam);
        printf("lParam:  0x%02X\n", msg.lParam);
        printf("Media:   %s\n", name);
        free(name);
    }
    return 0;
}

Comments