// Copyright 2018 RED Software, LLC. All Rights Reserved. #include "stdafx.h" #include "AppWindow.h" TCHAR AppWindow::mWindowClassName[] = _T("Project Torch"); HANDLE AppWindow::mMutexHandle = nullptr; AppWindow::AppWindow() { } AppWindow::~AppWindow() { if (mMutexHandle) { ::CloseHandle(mMutexHandle); } ::DestroyWindow(mWnd); } NiWindowRef AppWindow::Create(NiInstanceRef hi, unsigned int width, unsigned int height) { mWidth = width; mHeight = height; RECT rect = { 0, 0, mWidth, mHeight }; mWindowStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_CLIPCHILDREN; ::AdjustWindowRect(&rect, mWindowStyle, FALSE); mWnd = ::CreateWindow(GetWindowClassName(), GetWindowClassName(), mWindowStyle, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, nullptr, nullptr, hi, nullptr); if (mWnd) { ::SetWindowPos(mWnd, nullptr, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_FRAMECHANGED | SWP_HIDEWINDOW | SWP_NOACTIVATE); HMENU hMenu = GetSystemMenu(mWnd, FALSE); EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); mWindowStyle = ::GetWindowLong(mWnd, GWL_STYLE); ::ShowWindow(mWnd, SW_HIDE); } return mWnd; }