diff --git a/GUI/MainWindow.cpp b/GUI/MainWindow.cpp index e6eaadc0..9f287b6a 100644 --- a/GUI/MainWindow.cpp +++ b/GUI/MainWindow.cpp @@ -114,7 +114,7 @@ namespace NES { // Create window RECT rc = { 0, 0, 800, 700 }; AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE); - _hWnd = CreateWindow(L"NESEmu", L"NESEmu", + _hWnd = CreateWindow(L"NESEmu", _windowName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, _hInstance, nullptr); @@ -169,7 +169,12 @@ namespace NES { GetOpenFileName(&ofn); - return wstring(buffer); + wstring filepath(buffer); + + wstring filename = filepath.substr(filepath.find_last_of(L"/\\") + 1); + SetWindowText(_hWnd, (wstring(_windowName) + L": " + filename).c_str()); + + return filepath; } void MainWindow::Start(wstring romFilename = L"") diff --git a/GUI/MainWindow.h b/GUI/MainWindow.h index a7d3652e..04a819e3 100644 --- a/GUI/MainWindow.h +++ b/GUI/MainWindow.h @@ -8,6 +8,9 @@ namespace NES { { private: static MainWindow *Instance; + + const wchar_t* _windowName = L"NESEmu"; + HINSTANCE _hInstance; HWND _hWnd; int _nCmdShow;