以下书上的例子哪里错了?

来源:百度知道 编辑:UC知道 时间:2024/06/07 08:51:12
我新手,完全按书打的,不知道哪里出错了,运行不了。

//头文件

#include<windows.h>

//全局变量

HINSTANCE hinst;

//函数声明

int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int);
LRESULT CALLBACK MaiWndProc(HWND,UINT,WPARAM,LPARAM);

//功能 显示一个窗口

int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASSEX wcx;
HWND hwnd;
MSG msg;
BOOL fGotMessage;
hinst=hinstance;

//填充窗口类的数据结构
wcx.cbSize=sizeof(wcx);
wcx.style=CS_HREDRAW |
CS_VREDRAW;
wcx.lpfnWndProc=MainWndProc;
wcx.cbClsExtra=0;
wcx.cbWndExtra=0;
wcx.hInstance=hinstance;
wcx.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wcx.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wcx.lpszMenuName=NULL;
wcx.lpszClassName="MainWClass";
wcx.hIconSm=(HICON)LoadImage(hinstance,MAKEINTRESOU

#include<windows.h>

//全局变量

HINSTANCE hinst;

//函数声明

int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int);
LRESULT CALLBACK MainWndProc(HWND,UINT,WPARAM,LPARAM); //少了个n

//功能 显示一个窗口

int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASSEX wcx;
HWND hwnd;
MSG msg;
BOOL fGotMessage;
hinst=hinstance;

//填充窗口类的数据结构
wcx.cbSize=sizeof(wcx);
wcx.style=CS_HREDRAW | CS_VREDRAW;
wcx.lpfnWndProc=MainWndProc;
wcx.cbClsExtra=0;
wcx.cbWndExtra=0;
wcx.hInstance=hinstance;
wcx.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wcx.hCursor = LoadCursor (NULL, IDC_ARROW) ; //漏写
wcx.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wcx.lpszMenuName=NULL;
wcx.lpszClassName="MainWClass";
wcx.hIconSm=(HICON)LoadImage(hinstance,MAKEI