Skip to content

Commit

Permalink
Added source code
Browse files Browse the repository at this point in the history
  • Loading branch information
nthxny authored Oct 23, 2019
1 parent f92e4e7 commit 215f476
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions OfficeKeyFix.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 W, T, Y, O, P, D, L, X, N, and Space, respectively.
UINT offendingKeys[10] = { 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 < 10; 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 < 10; i++) {
UnregisterHotKey(NULL, i);
}

return 1;
}

0 comments on commit 215f476

Please sign in to comment.