vc9.0编win32连最简单的easywin都过不去?!!
来源:百度知道 编辑:UC知道 时间:2024/05/28 10:02:22
// 内容:一个基本的Win32程序//*******************************************************************
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "stdafx.h"
#include <windowsx.h>
#include <stdio.h>
#include<stdlib.h>
BOOL InitWindow( HINSTANCE hInstance, int nCmdShow );
LRESULT CALLBACK WinProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow)
{
MSG msg;
//创建主窗口
if ( !InitWindow( hInstance, nCmdShow ) )
return FALSE;
//进入消息循环:
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//程序结束
return msg.wParam;
}
//函数:InitWindow()
//功能:创建窗
去工程属性 将字符集换成多字体字符集
VC 9.0 默认是UNICODE 还有
#include "stdafx.h" 必须是第一个包含的头文件
修改了一下,通过了。
要注意:vc9.0和以往vc6不一样,不再默认使用ASCII码方式,所有和字符串相关的地方推荐使用“T”版本的,也就是ASCII和UNICODE自适应的宏定义好的函数。比如"XXX"要写成_T("XXX")才对,还有strlen()这类ASCII码版本的函数要替换为_tcslen()这种,char类型也要用TCHAR替换等等,void*类型也需要自己强转。你自己再对一下吧
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "stdafx.h"
#include <windowsx.h>
#include <stdio.h>
#include<stdlib.h>
BOOL InitWindow( HINSTANCE hInstance, int nCmdShow );
LRESULT CALLBACK WinProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow)
{
MSG msg;
//创建主窗口
if ( !InitWindow( hInstance, nCmdShow ) )
return FALSE;
//进入消息循环:
while (GetMessage(&msg, NULL, 0, 0))