From ab30c9638e1934f0ef5c388ce9b13dd4eee6fb7b Mon Sep 17 00:00:00 2001 From: ZombieRoxtar Date: Wed, 1 Apr 2015 16:00:40 -0400 Subject: [PATCH] Working Window It works like this, but some code review would be good. --- Hotkey-Blocker/Hotkey-Blocker.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Hotkey-Blocker/Hotkey-Blocker.cpp b/Hotkey-Blocker/Hotkey-Blocker.cpp index 7ed2360..9860c0f 100644 --- a/Hotkey-Blocker/Hotkey-Blocker.cpp +++ b/Hotkey-Blocker/Hotkey-Blocker.cpp @@ -4,10 +4,30 @@ #include #include +using namespace std; + +/* This is our message callback */ +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int main() { - SetConsoleTitle( TEXT( "Hotkey Blocker" )); + /* Create window class */ + WNDCLASSEX wc; + memset(&wc, 0, sizeof(wc)); + wc.cbSize = sizeof(wc); + wc.lpfnWndProc = WndProc; + wc.lpszClassName = TEXT("MessageWindowClass"); + RegisterClassEx(&wc); + + /* Create window (uses HWND_MESSAGE as the parent window to create message only window) */ + HWND window = CreateWindow(LPCWSTR(wc.lpszClassName), LPCWSTR("HotkeyMesageWindow"), 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); + if(!window) + { + cerr<< "Can't create a window for messaging!" <