From a30ce6c1fdfd998f7df32b980e39fe46ba797648 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Thu, 19 Jul 2018 01:59:06 +0200 Subject: [PATCH] add hotkey code to main thread --- windows-snapshot-tool/bin/freeze.exe | Bin 398830 -> 398830 bytes windows-snapshot-tool/src/main.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+) diff --git a/windows-snapshot-tool/bin/freeze.exe b/windows-snapshot-tool/bin/freeze.exe index 51cd4f12b78a23644443b016c35ba4a1cd8e990c..9d54705263a86ea025c74e6715ed8195d61b4535 100755 GIT binary patch delta 6444 zcmZu!30M?I+ODeZLR5r75J3=TfB`ww0RgWyP81c7;Haz@C}=#_Bg7;67!9ZxBt{qQ zm|9~J$9N>hBpOlLD^b_vG1)b{{JGRb6pv&fqO!)A%gFy$_Y6Wd{X9M2`@P>$Umaal zb8Bztt-Yb;Ygypu8=uQ&_p&yAwVO_>SV^l{yF0OjoKa&N@zfsB=BVNHDXmns(Koa` z>O>!R7bmGL(OUCK^o}-@$I;u`23{Y}LX9BO)kzvV>|Ed^tLxPr&(CzqOvHkaE7641 z=4sn~UZZbonXP)oEQq~Q+*snd9#k}@AY51zGjlQbgZ`*%tf2fCLBX!+?)(!IOR{|xV zWF8~LfJ>5A|HJ}Hc0vbO(q{EfbkV}Pi-zj6X!z=%ECD4?L#z8(M#x42O5(JQej$Bc zmjqQMaSl2AF$4aLPSiaQ)0xaz)mdPUG0fXD7h?3QR@eL1&DXB@J%gz!XxGW|IoxZ1 z#gAF!ciMC95`+8@UiSjXl`Dc(;D9xy+L?A+{QDWy-5auqH8t9N{~-Z&0=a8B40RiT zwDf$#e$ zGs4LzWR?_d z)vyc&!zBK@lLu8;6I1Dd5$``i3o1?=%XKlUT}1fN2-e*$`uNdUS|IZM=!5}J#yUyQ z(S#(G0{jCd#Ir?2*+_gy^2=Zbz;wyO(q1HSkHl_ub4E#L$!Cox?2M)d8zzz8!l2rXvO|PzQ;&gWC*ly@%sU@hB%DvE9H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ewZJ_@8W!{fsMZNz6`nuxK^RMtIN|)(#f8=QtSMV)Y`MX$H6+iJm Vv3DGL*H3&JrStW?fAKw${|`OkNTUD% diff --git a/windows-snapshot-tool/src/main.cpp b/windows-snapshot-tool/src/main.cpp index 77318c9..bfd17fb 100644 --- a/windows-snapshot-tool/src/main.cpp +++ b/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, ¬ifyIconData); + UnregisterHotKey(Hwnd, WM_HOTKEY_FREEZE); PostQuitMessage (0); break;