主题:一个经典程序的问题,都来看看
下面的程序用vc编译后有两个错误 unknown character '0xa1'
unknown character '0xa1'
请问各位朋友是怎么回事?
//////////////////////////////////////////////////////////////////////////////
#define WIN32_LEAN_AND_MEAN // just say no to MFC
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#include <math.h>
#include "resource.h"
#define WINDOW_CLASS_NAME "WINCLASS1"
//////////////////////////////////////////////////////////////////////////////
LRESULT CALLBACK WindowProc ( HWND hwnd,
UINT msg,
WPARAM wparam,
LPARAM lparam )
{
PAINTSTRUCT ps;
HDC hdc;
// 处理消息
switch ( msg )
{
case WM_CREATE:
{
return ( 0 ); // return success
}break;
case WM_PAINT:
{
hdc = BeginPaint ( hwnd, &ps );
EndPaint ( hwnd, &ps );
return ( 0 );
}break;
case WM_DESTROY:
{
PostQuitMessage ( 0 );
return ( 0 );
}break;
default : break;
} // end switch
return ( DefWindowProc ( hwnd, msg, wparam, lparam ) );
} // end WinProc
// WinMain /////////////////////////////////////////////////////////////////
int WINAPI WinMain ( HINSTANCE hinstance,
HINSTANCE hPrevInstance,
LPSTR lpcmdline,
int ncmdshow )
{
WNDCLASSEX winclass; // this will hold the class we create
HWND hwnd;
MSG msg;
winclass.cbSize = sizeof ( WNDCLASSEX );
winclass.style = CS_DBLCLKS | CS_OWNDC |
CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc = WindowProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hinstance;
winclass.hIcon = LoadIcon ( hinstance, MAKEINTRESOURCE(IDI_ICON1) );
winclass.hCursor = LoadCursor ( hinstance, MAKEINTRESOURCE(IDC_CURSOR1) );
winclass.hbrBackground = (HBRUSH) GetStockObject ( BLACK_BRUSH );
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME;
winclass.hIconSm = LoadIcon ( hinstance, MAKEINTRESOURCE(IDI_ICON1) );
// 注册windows类,将新的类通知windows
if ( !RegisterClassEx(&winclass) )
return ( 0 );
// 创建窗口
if ( !( hwnd = CreateWindowEx ( NULL,
WINDOW_CLASS_NAME,
"EASY WINDOW",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0,
400, 400,
NULL,
NULL,
hinstance,
NULL ) ) )
return ( 0 );
// 进入主事件循环
while ( GetMessage ( &msg, NULL, 0, 0 ) )
{
TranslateMessage ( &msg );
DispatchMessage ( &msg );
}
return (msg.wParam) ;
} //end WinMain
unknown character '0xa1'
请问各位朋友是怎么回事?
//////////////////////////////////////////////////////////////////////////////
#define WIN32_LEAN_AND_MEAN // just say no to MFC
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#include <math.h>
#include "resource.h"
#define WINDOW_CLASS_NAME "WINCLASS1"
//////////////////////////////////////////////////////////////////////////////
LRESULT CALLBACK WindowProc ( HWND hwnd,
UINT msg,
WPARAM wparam,
LPARAM lparam )
{
PAINTSTRUCT ps;
HDC hdc;
// 处理消息
switch ( msg )
{
case WM_CREATE:
{
return ( 0 ); // return success
}break;
case WM_PAINT:
{
hdc = BeginPaint ( hwnd, &ps );
EndPaint ( hwnd, &ps );
return ( 0 );
}break;
case WM_DESTROY:
{
PostQuitMessage ( 0 );
return ( 0 );
}break;
default : break;
} // end switch
return ( DefWindowProc ( hwnd, msg, wparam, lparam ) );
} // end WinProc
// WinMain /////////////////////////////////////////////////////////////////
int WINAPI WinMain ( HINSTANCE hinstance,
HINSTANCE hPrevInstance,
LPSTR lpcmdline,
int ncmdshow )
{
WNDCLASSEX winclass; // this will hold the class we create
HWND hwnd;
MSG msg;
winclass.cbSize = sizeof ( WNDCLASSEX );
winclass.style = CS_DBLCLKS | CS_OWNDC |
CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc = WindowProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hinstance;
winclass.hIcon = LoadIcon ( hinstance, MAKEINTRESOURCE(IDI_ICON1) );
winclass.hCursor = LoadCursor ( hinstance, MAKEINTRESOURCE(IDC_CURSOR1) );
winclass.hbrBackground = (HBRUSH) GetStockObject ( BLACK_BRUSH );
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME;
winclass.hIconSm = LoadIcon ( hinstance, MAKEINTRESOURCE(IDI_ICON1) );
// 注册windows类,将新的类通知windows
if ( !RegisterClassEx(&winclass) )
return ( 0 );
// 创建窗口
if ( !( hwnd = CreateWindowEx ( NULL,
WINDOW_CLASS_NAME,
"EASY WINDOW",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0,
400, 400,
NULL,
NULL,
hinstance,
NULL ) ) )
return ( 0 );
// 进入主事件循环
while ( GetMessage ( &msg, NULL, 0, 0 ) )
{
TranslateMessage ( &msg );
DispatchMessage ( &msg );
}
return (msg.wParam) ;
} //end WinMain