You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.3 KiB

#include <windows.h>
#include <tchar.h>
LRESULT CALLBACK windowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_SIZE:
break;
case WM_CLOSE:
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
break;
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
// 1 ×¢²á´°¿ÚÀà
::WNDCLASSEXA winClass;
winClass.lpszClassName = "Raster";
winClass.cbSize = sizeof(::WNDCLASSEX);
winClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS;
winClass.lpfnWndProc = windowProc;
winClass.hInstance = hInstance;
winClass.hIcon = 0;
winClass.hIconSm = 0;
winClass.hCursor = LoadCursor(NULL, IDC_ARROW);
winClass.hbrBackground = (HBRUSH)(BLACK_BRUSH);
winClass.lpszMenuName = NULL;
winClass.cbClsExtra = 0;
winClass.cbWndExtra = 0;
RegisterClassExA(&winClass);
// 2 ´´½¨´°¿Ú
HWND hWnd = CreateWindowEx(
NULL,
"Raster",
"Raster",
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
0,
0,
480,
320,
0,
0,
hInstance,
0
);
UpdateWindow( hWnd );
ShowWindow(hWnd,SW_SHOW);
MSG msg = {0};
while(true)
{
if (msg.message == WM_DESTROY
||msg.message == WM_CLOSE
||msg.message == WM_QUIT)
{
break;
}
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
return 0;
}