I am trying to load a string from my Strin Table in the DLL file I am working on. Here is the function that is supposed to load the string into a std::wstring
(since my project uses Unicode charset).
void ErrorHandler::load_error_string()
{
m_hInst = AfxGetInstanceHandle();
wchar_t buffer[1024] = { '\0' };
std::size_t string_length = LoadStringW(this->m_hInst, this->m_error_id, buffer, 1024);
this->m_raw_content = std::wstring(buffer, string_length);
CStringW output;
output.Format(L"%d", m_raw_content.length());
AfxMessageBox(output);
}
I have created the last three lines for diagnosing the method. The output of AfxMessageBox()
is 0
.
Where am I wrong?