第一个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 表示获取所有窗口的消息
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 表示获取所有窗口的消息
相关文章推荐
- 编写第一个程序应注意的问题
- VC 程序只运行一个进程,再次运行传参数给第一个进程的问题
- vc/mfc 发布程序时要注意的一些问题
- 命令行下的C++程序转换成VC的MFC程序需要注意的问题
- 用VS2010编写的C++程序,在其他电脑上无法运行,提示缺少mfc100.dll的解决办法 vc链接静态库的时候要注意的问题
- VC程序Debug版本和Release版本运行不一致问题
- 第一个DWR程序以及其中会遇到的各种问题
- vc链接静态库的时候要注意的问题
- 无法启动此程序,因为计算机中丢失VCRUNTIME140.dll 尝试重新安装此程序以解决此问题
- VC++ 实现VC程序启动时最小化到任务栏(完美解决闪烁问题)
- web程序使用Oracle需要注意的问题.
- 无法启动此程序,因为计算机中丢失VCRUNTIME140.dll 尝试重新安装此程序以解决此问题
- J2ME中The MIDlet suite was not found.问题--关于第一个HELLO程序
- ucGUI 使用VC模拟运行第一个程序
- Win7下运行VC程序UAC权限问题
- VC工程需要注意字符集问题
- MyEclipse第一个Servlet程序 --解决Win7系统下MyEclipse与Tomcat连接问题
- 微信小程序 使用include导入wxml注意的问题
- cordova 和android studio的第一个项目(常见问题注意!)
- 安装apache服务出错,无法启动此程序,因为计算机中丢失VCRUNTIME140.dll 尝试重新安装此程序以解决此问题