关于修改错误 from 'char [5]' to 'LPCWSTR'

来源:百度知道 编辑:UC知道 时间:2024/09/27 11:40:34
// 2008.10.22.17.08.cpp: 主项目文件。

#include "stdafx.h"
#include "iostream"
using namespace std;
#include "windows.h"
#include "string.h"
#include "stdlib.h"
#include "stdio.h"
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
HDC hdc;
HDC hdcmem;
HBITMAP hBm;
BITMAP bm;
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpszCmdLine,int nCmdShow)
{
HWND hwnd;
MSG Msg;
WNDCLASS wndclass;
char lpszClassName[]="位图";
char lpszTitle[]="Example_For_BitMap";
wndclass.style=0;
wndclass.lpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenu

hwnd=CreateWindow(lpszClassName,
lpszTitle,

改成

hwnd=CreateWindow(lpszClassName,
(LPCWSTR)lpszTitle,

这个都不用管的,在项目属性里面把字符集改成"使用多字节字符集"就行了,然后以后都不会出现这个问题了