运行中报错,自己查不出原因

问题遇到的现象和发生背景

应输入表达式和未定义标识符报错

问题相关代码,请勿粘贴截图

#include
#include
using namespace std;
const string ProgramTitle="Hello Windows";
LRESULT CALLBACK WinProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
RECT drawRect;
PAINTSTRUCT ps;
HDC hdc;

switch(message)
{
case WM_PAINT:
{
    hdc=BeginPaint(hWnd,&ps);
    for(int n=0;n<20;n++)
    {
        int x=n*20;
        int y=n*20;
        drawRect={x,y,x+100,y+20};
        DrawText(hdc,ProgramTitle.c_str(),ProgramTitle.length(),&drawRect,DT_CENTER);
    }
    EndPaint(hWnd,&ps);
}
break;

case WM_DESTROY:
    PostQuitMessage(0);
    break;
}
return DefWindowProc(hWnd,message,wParam,lParam);

}

ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wc;
wc.cbSize =sizeof(WNDCLASSEX);
wc.style =CS_HREDRAW|CS_VREDRAW;
wc.lpfnWndProc =(WNDPROC)WinProc;
wc.cbClsExtra =0;
wc.cbWndExtra =0;
wc.hInstance =hInstance;
wc.hIcon =NULL;
wc.hCursor =LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName =NULL;
wc.lpszClassName=ProgramTitle.c_str();
wc.hIconSm =NULL;
return RegisterClassEx(&wc);
}

bool InitInstance(HINSTANCE hInstance,int nCmdShow)
{
HWND hWnd=CreateWindow(
ProgranTitle.c_str(),
ProgranTitle.c_str(),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,
640,480,
NULL,
NULL,
hInstance,
NULL);

if(hWnd==0)return 0;

ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
return 1;

}

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
MyRegisterClass(hInstance);
if(!InitInstance(hInstance,nCmdShow)) return 0;

MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
    TranslateMessage(&msg);
    DispatchMessage(&msg);
}
return msg.wParam;

}

我的解答思路和尝试过的方法

改了字符集还是没解决问题

我想要达到的结果

输出几行文字

你把报错截图发一下

const string ProgramTitle="Hello Windows";改为const wstring ProgramTitle = L"Hello Windows";
编码改成使用Unicode字符集
如有帮助,请采纳

还是没解决,不过还是谢谢了。