diff --git a/MUtilities_VS2013.vcxproj b/MUtilities_VS2013.vcxproj
index d832154..8aa4ecb 100644
--- a/MUtilities_VS2013.vcxproj
+++ b/MUtilities_VS2013.vcxproj
@@ -16,6 +16,7 @@
+
diff --git a/MUtilities_VS2013.vcxproj.filters b/MUtilities_VS2013.vcxproj.filters
index d48f878..ff32638 100644
--- a/MUtilities_VS2013.vcxproj.filters
+++ b/MUtilities_VS2013.vcxproj.filters
@@ -42,6 +42,9 @@
Source Files
+
+ Source Files
+
diff --git a/include/MUtils/Exception.h b/include/MUtils/Exception.h
index ede846c..a9b256d 100644
--- a/include/MUtils/Exception.h
+++ b/include/MUtils/Exception.h
@@ -40,12 +40,12 @@ while(0)
catch(const std::exception &error) \
{ \
MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); \
- MUtils::OS::fatal_exit("Unhandeled C++ exception error, application will exit!"); \
+ MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); \
} \
catch(...) \
{ \
MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); \
- MUtils::OS::fatal_exit("Unhandeled C++ exception error, application will exit!"); \
+ MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); \
} \
} \
while(0)
diff --git a/include/MUtils/OSSupport.h b/include/MUtils/OSSupport.h
index 5b674e1..3fce410 100644
--- a/include/MUtils/OSSupport.h
+++ b/include/MUtils/OSSupport.h
@@ -114,7 +114,7 @@ namespace MUtils
MUTILS_API int network_status(void);
//Error handling
- MUTILS_API void fatal_exit(const char* const errorMessage);
+ MUTILS_API void fatal_exit(const wchar_t* const errorMessage);
}
}
diff --git a/src/DLLMain.cpp b/src/DLLMain.cpp
new file mode 100644
index 0000000..7c94ca8
--- /dev/null
+++ b/src/DLLMain.cpp
@@ -0,0 +1,43 @@
+///////////////////////////////////////////////////////////////////////////////
+// MuldeR's Utilities for Qt
+// Copyright (C) 2004-2014 LoRd_MuldeR
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+// http://www.gnu.org/licenses/lgpl-2.1.txt
+//////////////////////////////////////////////////////////////////////////////////
+
+#ifdef _MSC_VER
+#ifndef MUTILS_STATIC_LIB
+
+//Win32 API
+#define WIN32_LEAN_AND_MEAN 1
+#include
+
+BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
+#endif //MUTILS_STATIC_LIB
+#endif //_MSC_VER
diff --git a/src/OSSupport_Win32.cpp b/src/OSSupport_Win32.cpp
index 48976e7..5b201ae 100644
--- a/src/OSSupport_Win32.cpp
+++ b/src/OSSupport_Win32.cpp
@@ -46,19 +46,21 @@ static const DWORD g_main_thread_id = GetCurrentThreadId();
// SYSTEM MESSAGE
///////////////////////////////////////////////////////////////////////////////
+static const UINT g_msgBoxFlags = MB_TOPMOST | MB_TASKMODAL | MB_SETFOREGROUND;
+
void MUtils::OS::system_message_nfo(const wchar_t *const title, const wchar_t *const text)
{
- MessageBoxW(NULL, text, title, MB_TOPMOST | MB_TASKMODAL | MB_ICONINFORMATION);
+ MessageBoxW(NULL, text, title, g_msgBoxFlags | MB_ICONINFORMATION);
}
void MUtils::OS::system_message_wrn(const wchar_t *const title, const wchar_t *const text)
{
- MessageBoxW(NULL, text, title, MB_TOPMOST | MB_TASKMODAL | MB_ICONWARNING);
+ MessageBoxW(NULL, text, title, g_msgBoxFlags | MB_ICONWARNING);
}
void MUtils::OS::system_message_err(const wchar_t *const title, const wchar_t *const text)
{
- MessageBoxW(NULL, text, title, MB_TOPMOST | MB_TASKMODAL | MB_ICONERROR);
+ MessageBoxW(NULL, text, title, g_msgBoxFlags | MB_ICONERROR);
}
///////////////////////////////////////////////////////////////////////////////
@@ -432,11 +434,11 @@ static volatile bool g_fatal_exit_flag = true;
static DWORD WINAPI fatal_exit_helper(LPVOID lpParameter)
{
- MessageBoxA(NULL, ((LPCSTR) lpParameter), "GURU MEDITATION", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST | MB_SETFOREGROUND);
+ MUtils::OS::system_message_err((LPWSTR) lpParameter, L"GURU MEDITATION");
return 0;
}
-void MUtils::OS::fatal_exit(const char* const errorMessage)
+void MUtils::OS::fatal_exit(const wchar_t* const errorMessage)
{
g_fatal_exit_lock.enter();