VC++问题,按照课本写的,但是编译不成功,能解决所有问题的给他分

来源:百度知道 编辑:UC知道 时间:2024/09/22 15:28:05
#include <windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hINstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdParam,
int nCmdShow)
{
static char szAppName[]="xianshi";
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
if(! hPrevInstance)
{
wndclass.style = CS_HREDRAW | CS_VERDRAW;
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.hbrBackgroud = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = NULL;
RegisterClass(&wndclass);
}
hwnd=CreateWindow(
szAppName,
"The XianShi",
WS_OVERLAPPEDWINDOW,
CW_USERDEFAULT,CW_USEDEFAU

这是我修改好的程序
错误的语句用//注释掉了,下一行为修正后的语句
HFONT hnewFont;//**********
HFONT holdFont;//**********
这两句是新添加的,其余的都是在你的基础上改正的

#include <windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hINstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdParam,
int nCmdShow)
{
static char szAppName[]="xianshi";
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
if(! hPrevInstance)
{
//wndclass.style = CS_HREDRAW | CS_VERDRAW;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
//wndclass.hInstance=hInstance;
wndclass.hInstance=hINstance;
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
//wndclass.hbrBackgroud = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wndclass.hbrBackground=(HBRUSH)GetStockObjec