Set filename in title bar

This commit is contained in:
Souryo 2014-06-29 10:06:30 -04:00
parent 7191e467a9
commit c40e207301
2 changed files with 10 additions and 2 deletions

View file

@ -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"")

View file

@ -8,6 +8,9 @@ namespace NES {
{
private:
static MainWindow *Instance;
const wchar_t* _windowName = L"NESEmu";
HINSTANCE _hInstance;
HWND _hWnd;
int _nCmdShow;