您的位置:首页 > 编程语言 > C语言/C++

第一个VC++程序注意的问题

2010-07-16 16:53 183 查看
1. VS2005 项目属性-->配置属性-->C/C++-->常规-->检测64位可移植性问题-->否

2.

问题: 无法从“const char [10]”转换为“LPCWSTR”

解决: VS2005 项目属性-->配置属性-->常规-->字符集-->未设置

原因: LPWSTR MSDN解释 W= Unicode character string

For example, to convert from a Unicode string to a generic string without changing the converted string, use CW2CT.

If it is known that the converted string is unlikely to be more than 64 characters, the EX version, such as CW2CTEX<64>, can be used to save space on the stack.

3.

问题:“WinMain”: 无法重载函数

解决:

int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd
)

4. 如果下面2个标红的窗口类名不一样, 运行时不会报错, 但是窗口显示不出来

wndcls.lpszClassName = "ferry2010";

hwnd = CreateWindow("ferry2010", "渡口网络", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 600, 400, NULL, NULL, hInstance, NULL);

5. while(GetMessage(&msg, NULL, 0, 0)) NULL 表示获取所有窗口的消息
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: