Added single instance lock and release error system
This commit is contained in:
parent
c3599ed150
commit
c63fd0ec88
@ -103,14 +103,19 @@ namespace nf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Application::registerWindowClass() {
|
void Application::registerWindowClass() {
|
||||||
m_wclassName = L"NFClass";
|
if (!FindWindow(L"NFClass", NULL)) {
|
||||||
WNDCLASS wclass = { };
|
m_wclassName = L"NFClass";
|
||||||
wclass.lpszClassName = m_wclassName;
|
WNDCLASS wclass = { };
|
||||||
wclass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
wclass.lpszClassName = m_wclassName;
|
||||||
wclass.hIcon = NULL;
|
wclass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
wclass.hInstance = m_hInst;
|
wclass.hIcon = NULL;
|
||||||
wclass.lpfnWndProc = Application::WindowProc;
|
wclass.hInstance = m_hInst;
|
||||||
RegisterClass(&wclass);
|
wclass.lpfnWndProc = Application::WindowProc;
|
||||||
|
RegisterClass(&wclass);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Error("Cannot run two NF applications at once.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::toggleFullscreen() {
|
void Application::toggleFullscreen() {
|
||||||
|
@ -28,7 +28,8 @@ DebugBreak();
|
|||||||
#else
|
#else
|
||||||
#define DEBUGINIT
|
#define DEBUGINIT
|
||||||
#define Log(x)
|
#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
|
#endif
|
||||||
|
|
||||||
const wchar_t* toWide(const char* in);
|
const wchar_t* toWide(const char* in);
|
||||||
|
Reference in New Issue
Block a user