#include<windows.h>
#include <time.h>
#include<TCHAR.h>
........
........
void ShellDraw( HDC hdc )
{
// HDC hMemDc;
// BOOL ret = TRUE;
// HDC hMemoryDC;
// HBITMAP hbmp;
//分数提示显示文字
char szText[30]="Score: ";
char szNum[20]; int iNowScore = iScores*100;
_itoa(iNowScore,szNum,10);
strcat(szText, szNum);
RECT rt, rect;
GetClientRect(hAppWnd, &rt);
//墙的绘制
SelectObject(hdc,hbrushWall);
PatBlt(hdc,rt.left,rt.top,rt.right,rt.bottom,PATCOPY);
//内部游戏区的白色底平面
rect.left = rt.left+WALL_WIDTH;
rect.top = rt.top + WALL_HEIGHT;
rect.right = rt.right - WALL_WIDTH;
rect.bottom = rt.bottom - WALL_HEIGHT;
FillRect(hdc, &rect, (HBRUSH) (COLOR_WINDOW+1));
//分数提示板的绘制
/* hMemoryDC = CreateCompatibleDC(NULL);
hbmp = CreateCompatibleBitmap(hdc,265,55);
SelectObject(hMemoryDC,hbrushScore);
SelectObject(hMemoryDC,hbmp);
PatBlt(hMemoryDC,0,0,256,55,PATCOPY);
BitBlt(hdc,GetSystemMetrics(SM_CXSCREEN)/3,
10,256,55,hMemoryDC,0,0,SRCCOPY);
*/
BitBlt(hdc,GetSystemMetrics(SM_CXSCREEN)/3,
10,256,55,scoreDC,0,0,SRCCOPY);
//分数的打印绘制
SetBkMode(hdc, TRANSPARENT);
TextOut(hdc, GetSystemMetrics(SM_CXSCREEN)/3+50, 30, szText,strlen(szText));
//这里不能将参数 4 从“char [30]”转换为“LPCWSTR”
}
#include <time.h>
#include<TCHAR.h>
........
........
void ShellDraw( HDC hdc )
{
// HDC hMemDc;
// BOOL ret = TRUE;
// HDC hMemoryDC;
// HBITMAP hbmp;
//分数提示显示文字
char szText[30]="Score: ";
char szNum[20]; int iNowScore = iScores*100;
_itoa(iNowScore,szNum,10);
strcat(szText, szNum);
RECT rt, rect;
GetClientRect(hAppWnd, &rt);
//墙的绘制
SelectObject(hdc,hbrushWall);
PatBlt(hdc,rt.left,rt.top,rt.right,rt.bottom,PATCOPY);
//内部游戏区的白色底平面
rect.left = rt.left+WALL_WIDTH;
rect.top = rt.top + WALL_HEIGHT;
rect.right = rt.right - WALL_WIDTH;
rect.bottom = rt.bottom - WALL_HEIGHT;
FillRect(hdc, &rect, (HBRUSH) (COLOR_WINDOW+1));
//分数提示板的绘制
/* hMemoryDC = CreateCompatibleDC(NULL);
hbmp = CreateCompatibleBitmap(hdc,265,55);
SelectObject(hMemoryDC,hbrushScore);
SelectObject(hMemoryDC,hbmp);
PatBlt(hMemoryDC,0,0,256,55,PATCOPY);
BitBlt(hdc,GetSystemMetrics(SM_CXSCREEN)/3,
10,256,55,hMemoryDC,0,0,SRCCOPY);
*/
BitBlt(hdc,GetSystemMetrics(SM_CXSCREEN)/3,
10,256,55,scoreDC,0,0,SRCCOPY);
//分数的打印绘制
SetBkMode(hdc, TRANSPARENT);
TextOut(hdc, GetSystemMetrics(SM_CXSCREEN)/3+50, 30, szText,strlen(szText));
//这里不能将参数 4 从“char [30]”转换为“LPCWSTR”
}
1>main.cpp
1>c:\users\administrator\desktop\snake_dlf\snake_dlf\main.cpp(308) : warning C4996: '_itoa': This function or variable may be unsafe. Consider using _itoa_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> e:\study\vc\vc2008\vc\include\stdlib.h(465) : 参见“_itoa”的声明
1>c:\users\administrator\desktop\snake_dlf\snake_dlf\main.cpp(309) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> e:\study\vc\vc2008\vc\include\string.h(79) : 参见“strcat”的声明
1>c:\users\administrator\desktop\snake_dlf\snake_dlf\main.cpp(337) : error C2664: “TextOutW”: 不能将参数 4 从“char [30]”转换为“LPCWSTR”
1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
.......
http://msdn.microsoft.com/en-us/library/w1sc4t4k