From e29e7f3d904d0332eb79b582c729fb5c65267558 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Thu, 19 Jul 2018 01:32:18 +0200 Subject: [PATCH] fix everything --- windows-snapshot-tool/bin/freeze.exe | Bin 398120 -> 400845 bytes .../src/LimitSingleInstance.h | 38 ++++++++++++++++++ windows-snapshot-tool/src/main.cpp | 12 ++++++ 3 files changed, 50 insertions(+) create mode 100644 windows-snapshot-tool/src/LimitSingleInstance.h diff --git a/windows-snapshot-tool/bin/freeze.exe b/windows-snapshot-tool/bin/freeze.exe index e4bdc8195eebf37f6307a0bed74eefe0b2d0ae9d..6d760b55c705dac99edbe23803b5e5c83c90c663 100755 GIT binary patch delta 21828 zcmb_^4L}uD+W*Yl8AL$2A|NUvAD0gi>4FGmW>*C@Q^W5s){6ovhRDK2T{AC*x)NIG zn8$kA0yDF+jgq`tW>l8ino(IxMux4si%FZ?vgNiG@9&wJ`!P-J{{Q>#)N{|7-}yby zdCqe_XSm*j2O{2iIihacpw4&hT+D5dxPo3B*TMDT19>5eOX4_g($0OE!mhV>UP$h} zHwgC)C}(N=r2%rwut?d)M@S3GIqs+e?X-%lY@g&GP?89y8ImO5&krA#f}GD~OI zHtz8j`Z$S?Mr(zQt1)*T2$Q#o(L$$1ep+1Et2N2Sbv6%>1Ef45-6F4);)R>y97ae))6+YC#oU{8DEoO>3j;=nu#}R@4Qjtu=v-AmYQi6v9mTteymqyukj&J4Xu!0 z?-egR5i4Km6)miZkpum0!l)Q|x_`7_ijmj&C-BGRJ^t~dUX13rD;vJ=>8Z`ByVCJP zPY>iyh@+dT|uX$_3)9$P3Me$@-_b`A+?`u?j0pWnPqG5Va{XG`S5*p zG{wK=eHT&*Cd^;Axi(;R^a<{Tnhr*aNjDbZ>@iWpO^B2`g@ z0q^W2EAc!T;GAB|EnXw(Cr{;^g>6*ctR_d5L>WX}W1-uJnw--+at@LQt#Vqx zCi7m+g!S?%!1?sh+TQ`Feym+zFXLpHlLU4Qp@JS*SPHJv z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f&8*OwUI&u}?>&b>sLGAnlrl zYUeVLow~aI10=`9hJP!iC7Thi#(3WyHVnuioy~Y4_~z62Ek0vsA%9$Fe<+Y<9shnH ztvX~Dkc&F4Y9KUG)wP;_nLKxX*{njHpXbosP62~f2sQbp6JmSB6~N<0YBkASnCv8&kC&KoRTH6UjC zRRb<>Ej&Hzb*qSx~G-Lar<)R96$@GsSL4#fc3u0sX^nWIC-0HMq4&{VPm#CzN*HE@=P zaPyV*+N;(8k{P?N*T=m;+;6(@6xTaCLq$b&e83Ra_3&wMth$DM0c0g>`T>7p{wajL z`2$`ZBskazgJf1U-5tnromw1_Q##IFK&o||DM0pksxMkNclP|LC0vRJfjaj9I9EMd z_(4EPNd?Abu8vd=($09_^=26mvo6%@fzaiR*>eWu4IoiEt@nXk@l;RxZC2XMad{2> zpcu0FAi?;_f_^iMp`Yb)4j)b`5Los>1_QC{sviMlrEccV2&Ml8g@;r$bsBylfIid3 zV}Vkcujyq#8a-O%$|fL(kdg}|SZ@tlM}d^1&^xLw0a4oTZT*jc*6FG@;pYdHy2_$} z9Mu_02eMMf83TkaujLXA@w&K-?2HG=3vDu}y#mAr4&tV@>`epbi~;#EjD7qc{4S;o z{{Byw*Nv!fX1Oj|E24Cb%rx+BHy~4h1nL?&4@jdf5Pt%qpK*-_JG+3Kp|E?K{h@($ z$$;?qvp-$lrUV-h8;~@eLs>v}>5%b28cf-~HT|C`j`e7g^b#|5mIjEbVn+;kAdkn=C@l;0M{u87*I<+r>6njh;%`BgbY0b@0 z9byNrJ$#Ek+6f%F0WbF!j|-M4 z*R`9{3p{J${dTx^3w}XnSDU}z-*~n;&~LQM+|}>2z+MaS^K%InzfXBrcz3_&Os@As z{qE&m1H%2r3+$O5etp8`K3G~*lsj|Q___0EJha%k;GyZ`9qHMwz(~KNJo~1n-{0Bk ND8E6hZ?s?S{{ypXyjuVO diff --git a/windows-snapshot-tool/src/LimitSingleInstance.h b/windows-snapshot-tool/src/LimitSingleInstance.h new file mode 100644 index 0000000..bdf6c7e --- /dev/null +++ b/windows-snapshot-tool/src/LimitSingleInstance.h @@ -0,0 +1,38 @@ +#ifndef LimitSingleInstance_H +#define LimitSingleInstance_H + +#include + +//This code is from Q243953 in case you lose the article and wonder +//where this code came from. +class CLimitSingleInstance +{ +protected: + DWORD m_dwLastError; + HANDLE m_hMutex; + +public: + CLimitSingleInstance(TCHAR *strMutexName) + { + //Make sure that you use a name that is unique for this application otherwise + //two apps may think they are the same if they are using same name for + //3rd parm to CreateMutex + m_hMutex = CreateMutex(NULL, FALSE, strMutexName); //do early + m_dwLastError = GetLastError(); //save for use later... + } + + ~CLimitSingleInstance() + { + if (m_hMutex) //Do not forget to close handles. + { + CloseHandle(m_hMutex); //Do as late as possible. + m_hMutex = NULL; //Good habit to be in. + } + } + + BOOL IsAnotherInstanceRunning() + { + return (ERROR_ALREADY_EXISTS == m_dwLastError); + } +}; +#endif diff --git a/windows-snapshot-tool/src/main.cpp b/windows-snapshot-tool/src/main.cpp index 36b1813..aee8bdc 100644 --- a/windows-snapshot-tool/src/main.cpp +++ b/windows-snapshot-tool/src/main.cpp @@ -1,4 +1,8 @@ #include "resource.h" +#include "LimitSingleInstance.h" + + +CLimitSingleInstance g_SingleInstanceObj(TEXT("Global\\{38593226-AABB-1234-7592-D335AAB6F22A}")); /*variables*/ UINT WM_TASKBAR = 0; @@ -26,6 +30,13 @@ int WINAPI WinMain (HINSTANCE hThisInstance, LPSTR lpszArgument, int nCmdShow) { + if (g_SingleInstanceObj.IsAnotherInstanceRunning()) + { + HWND existingApp = FindWindow(0, szClassName); + SendMessage(existingApp, WM_DESTROY, 0, 0); + //return FALSE; + } + /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ @@ -181,6 +192,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM break; case WM_HOTKEY_FREEZE: + case WM_HOTKEY: { doScreenshot(); }