forked from acook/OfficeKeyFix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOfficeKeyFix.cpp
35 lines (28 loc) · 949 Bytes
/
OfficeKeyFix.cpp
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
#include <windows.h>
#include <stdio.h>
#include <thread>
#include <chrono>
#include <iostream>
int main(int argc, wchar_t* argv[])
{
//Build Array Of Keys To Unregister
//These map to None, W, T, Y, O, P, D, L, X, N and Space respectively.
UINT offendingKeys[11] = {0x00, 0x57, 0x54, 0x59, 0x4F, 0x50, 0x44, 0x4C, 0x58, 0x4E, 0x20};
//Kill Explorer
system("taskkill /IM explorer.exe /F");
//Register hotkey
for (int i = 0; i < 11; i++) {
RegisterHotKey(NULL, i, 0x1 + 0x2 + 0x4 + 0x8 | MOD_NOREPEAT, offendingKeys[i]);
}
//Restart Explorer
system("start C:/Windows/explorer.exe");
/* Sleep for a few seconds to make sure Explorer has time to
attempt to register the Office hotkeys, and get blocked by
our hotkeys */
std::this_thread::sleep_for(std::chrono::milliseconds(4000));
//deregister hotkeys by ID
for (int i = 0; i < 11; i++) {
UnregisterHotKey(NULL, i);
}
return 0;
}