我的这个错在哪?

来源:百度知道 编辑:UC知道 时间:2024/07/08 02:52:11
#include <windows.h>
LRESULT CALLBACK WinProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);

int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
WNDCLASS wndcls;
wndcls.style=0;
wndcls.lpfnWndProc=WinProc;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hInstance=hInstance;
wndcls.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndcls.hCursor=LoadCursor(NULL,IDC_ARROW);
wndcls.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndcls.lpszMenuName=0;
wndcls.lpszClassName="赵辉勇";
if (!RegisterClass(&wndcls))
{MessageBeep(0); return FALSE;}

最后一个}应该移到 return msg.wParam; 之后

#include <windows.h>
LRESULT CALLBACK WinProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);

int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
WNDCLASS wndcls;
wndcls.style=0;
wndcls.lpfnWndProc=WinProc;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hInstance=hInstance;
wndcls.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndcls.hCursor=LoadCursor(NULL,IDC_ARROW);
wndcls.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndcls.lpszMenuName=0;
wndcls.lpszClassName="赵辉勇";
if (!RegisterClass(&wndcls))
{MessageBeep(0); return FALSE;}