From 63c5951a2ea3e6cc4a7ff103ada087dbc123c42e Mon Sep 17 00:00:00 2001 From: Cas Ebbers Date: Mon, 29 Jan 2018 14:51:17 +0100 Subject: [PATCH] Prevent double instances --- code/Main.c | 11 +++++++++++ misc/msvc/JulianaNFC.sln | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/code/Main.c b/code/Main.c index 9030e33..769abd2 100644 --- a/code/Main.c +++ b/code/Main.c @@ -179,6 +179,17 @@ UINT juliana_run() int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { + CreateMutex(NULL, FALSE, APPLICATION_NAME); + if (ERROR_ALREADY_EXISTS == GetLastError()) { + MessageBox( + NULL, + APPLICATION_NAME L" is al gestart.", + APPLICATION_NAME, + MB_OK | MB_ICONERROR + ); + return 0; + } + juliana_init(hInstance); nfc_init(); diff --git a/misc/msvc/JulianaNFC.sln b/misc/msvc/JulianaNFC.sln index 0ed779d..1020ed5 100644 --- a/misc/msvc/JulianaNFC.sln +++ b/misc/msvc/JulianaNFC.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.27004.2006 +VisualStudioVersion = 15.0.27004.2008 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JulianaNFC", "JulianaNFC.vcxproj", "{71B2B17F-9C7B-4834-9751-C4FF5BBF0275}" EndProject @@ -9,6 +9,8 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + DefaultBuild|x64 = DefaultBuild|x64 + DefaultBuild|x86 = DefaultBuild|x86 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection @@ -17,6 +19,10 @@ Global {71B2B17F-9C7B-4834-9751-C4FF5BBF0275}.Debug|x64.Build.0 = Debug|x64 {71B2B17F-9C7B-4834-9751-C4FF5BBF0275}.Debug|x86.ActiveCfg = Debug|Win32 {71B2B17F-9C7B-4834-9751-C4FF5BBF0275}.Debug|x86.Build.0 = Debug|Win32 + {71B2B17F-9C7B-4834-9751-C4FF5BBF0275}.DefaultBuild|x64.ActiveCfg = Debug|x64 + {71B2B17F-9C7B-4834-9751-C4FF5BBF0275}.DefaultBuild|x64.Build.0 = Debug|x64 + {71B2B17F-9C7B-4834-9751-C4FF5BBF0275}.DefaultBuild|x86.ActiveCfg = Debug|Win32 + {71B2B17F-9C7B-4834-9751-C4FF5BBF0275}.DefaultBuild|x86.Build.0 = Debug|Win32 {71B2B17F-9C7B-4834-9751-C4FF5BBF0275}.Release|x64.ActiveCfg = Release|x64 {71B2B17F-9C7B-4834-9751-C4FF5BBF0275}.Release|x64.Build.0 = Release|x64 {71B2B17F-9C7B-4834-9751-C4FF5BBF0275}.Release|x86.ActiveCfg = Release|Win32