I have code that was 1st developed with Visual C++ Version 1.52 (working and self taught). A couple of years ago I adapted it with Visual Studio and got it working. I am now trying it again with Visual Studio 2022 but I can't get the SetWindowText function to work as it had. It does change the parent window title text but it is gobbledygook. I assume it's a UNICODE problem but so far haven't been able to negotiate the maze of explanation. It is set in a wizard generated MFC document. I'm including the function. Any suggestions?
void CTICTACView::Game()
{
CWnd* p_Wnd = GetParent();
const char* capt = "TIC TAC TOE";
const char* gm = "GAME!";
if (!game)
p_Wnd->SetWindowText((LPCTSTR)capt);
else
p_Wnd->SetWindowText((LPCTSTR)gm);
}
After constructing Frankenstein from bits and pieces, this is what I finally got to work. Thank you everybody.
void CTICTACView::Game()
{
CWnd* p_Wnd = GetParent();
const wchar_t* capt =_T("TIC TAC TOE");
const wchar_t* gm = _T("GAME!");
if (!game)
p_Wnd->SetWindowText((LPCWSTR)capt);
else
p_Wnd->SetWindowText((LPCWSTR)gm);
}