Browse Source

add hotkey code to main thread

main
Hendrik Langer 6 years ago
parent
commit
a30ce6c1fd
  1. BIN
      windows-snapshot-tool/bin/freeze.exe
  2. 10
      windows-snapshot-tool/src/main.cpp

BIN
windows-snapshot-tool/bin/freeze.exe

Binary file not shown.

10
windows-snapshot-tool/src/main.cpp

@ -85,9 +85,16 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
/* Make the window visible on the screen */
ShowWindow (Hwnd, nCmdShow);
minimize();
/* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&messages, NULL, 0, 0))
{
if (messages.message == WM_HOTKEY)
{
doScreenshot();
}
/* Translate virtual-key messages into character messages */
TranslateMessage(&messages);
/* Send message to WindowProcedure */
@ -213,6 +220,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_DESTROY:
// quit the application.
Shell_NotifyIcon(NIM_DELETE, &notifyIconData);
UnregisterHotKey(Hwnd, WM_HOTKEY_FREEZE);
PostQuitMessage (0);
break;

Loading…
Cancel
Save