project64/Source/Project64/UserInterface/WTLControls/GetCWindowText.h

17 lines
415 B
C
Raw Normal View History

#pragma once
#include "stdafx.h"
inline static stdstr GetCWindowText(const CWindow *window)
{
stdstr Result;
2020-05-12 12:19:05 +00:00
int nLen = ::GetWindowTextLengthW(window->m_hWnd);
if (nLen == 0)
{
return Result;
}
2020-05-12 12:19:05 +00:00
std::wstring WindowText;
WindowText.resize(nLen + 1);
::GetWindowTextW(window->m_hWnd, (wchar_t *)WindowText.c_str(), nLen + 1);
return Result.FromUTF16(WindowText.c_str());
}