Added single instance lock and release error system

This commit is contained in:
grayson committed 2021-08-18 12:22:57 -05:00
1 parent c3599ed150
commit c63fd0ec88
2 files changed
+15 -9

No files matched your search

+13 -8
View File
@@ -103,14 +103,19 @@ namespace nf {
}
void Application::registerWindowClass() {
m_wclassName = L"NFClass";
WNDCLASS wclass = { };
wclass.lpszClassName = m_wclassName;
wclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wclass.hIcon = NULL;
wclass.hInstance = m_hInst;
wclass.lpfnWndProc = Application::WindowProc;
RegisterClass(&wclass);
if (!FindWindow(L"NFClass", NULL)) {
m_wclassName = L"NFClass";
WNDCLASS wclass = { };
wclass.lpszClassName = m_wclassName;
wclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wclass.hIcon = NULL;
wclass.hInstance = m_hInst;
wclass.lpfnWndProc = Application::WindowProc;
RegisterClass(&wclass);
}
else {
Error("Cannot run two NF applications at once.");
}
}
void Application::toggleFullscreen() {
+2 -1
View File
@@ -28,7 +28,8 @@ DebugBreak();
#else
#define DEBUGINIT
#define Log(x)
#define Error(x)
#define Error(x) MessageBox(FindWindow(L"NFClass", NULL), toWide(x), L"NF Engine Error", MB_OK | MB_ICONERROR);\
std::exit(-1)
#endif
const wchar_t* toWide(const char* in);