简单问题,高分送!!
以下代码在.net2005环境中编译时出现错误
HWND hwnd=GetForegroundWindow();
HDC hdc=GetDC(hwnd);
char buf[20];
memset(buf,0,20);
sprintf_s(buf,"x=%d,y=%d",x,y);
TextOut(hdc,0,0,buf,strlen(buf));
ReleaseDC(hwnd,hdc);
错误如下:
error C2664: 'TextOutW' : cannot convert parameter 4 from 'char [20]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
请问如何解决??