// win32004.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch (uMsg)
{
//窗口关闭
case WM_CLOSE:
{
PostQuitMessage(-1);
}
break;
}
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS swc={0};
swc.lpszClassName="mc";
swc.style=CS_HREDRAW|CS_VREDRAW;
swc.lpfnWndProc=WindowProc;
ATOM atom=RegisterClass(&swc);
//主窗口
HWND hmainwind=CreateWindow(
"mc",
"主窗口",
WS_OVERLAPPEDWINDOW|WS_VISIBLE,
300,
300,
400,
400,
NULL,
NULL,hInstance,NULL
);
ShowWindow(hmainwind,SW_SHOWNORMAL);
UpdateWindow(hmainwind);
//获取消息
MSG msg={0};
while(GetMessage(&msg,0,0,0))
{
DispatchMessage(&msg);
}
return 0;
}
//
#include "stdafx.h"
LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch (uMsg)
{
//窗口关闭
case WM_CLOSE:
{
PostQuitMessage(-1);
}
break;
}
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS swc={0};
swc.lpszClassName="mc";
swc.style=CS_HREDRAW|CS_VREDRAW;
swc.lpfnWndProc=WindowProc;
ATOM atom=RegisterClass(&swc);
//主窗口
HWND hmainwind=CreateWindow(
"mc",
"主窗口",
WS_OVERLAPPEDWINDOW|WS_VISIBLE,
300,
300,
400,
400,
NULL,
NULL,hInstance,NULL
);
ShowWindow(hmainwind,SW_SHOWNORMAL);
UpdateWindow(hmainwind);
//获取消息
MSG msg={0};
while(GetMessage(&msg,0,0,0))
{
DispatchMessage(&msg);
}
return 0;
}