-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPausePlay.cpp
More file actions
40 lines (31 loc) · 808 Bytes
/
Copy pathPausePlay.cpp
File metadata and controls
40 lines (31 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "framework.h"
#define MAX_LOADSTRING 100
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
INPUT inputs[2] = {};
ZeroMemory(inputs, sizeof(inputs));
WORD mVk;
switch (lpCmdLine[1])
{
case 'p':
case 'P':
mVk = VK_MEDIA_PREV_TRACK;
break;
case 'n':
case 'N':
mVk = VK_MEDIA_NEXT_TRACK;
break;
default:
mVk = VK_MEDIA_PLAY_PAUSE;
}
inputs[0].type = INPUT_KEYBOARD;
inputs[0].ki.wVk = mVk;
inputs[1].type = INPUT_KEYBOARD;
inputs[1].ki.wVk = mVk;
inputs[1].ki.dwFlags = KEYEVENTF_KEYUP;
UINT uSent = SendInput(ARRAYSIZE(inputs), inputs, sizeof(INPUT));
return uSent != ARRAYSIZE(inputs) ? 1 : 0;
}