#include <windows.h>
#include <windowsx.h>
LRESULT CALLBACK WinProc(HWND, UINT, WPARAM, LPARAM);
BOOL InitApp(HINSTANCE, int);
HWND hWnd;
char szWinName[] = "Skeleton";
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode)
{
MSG msg;
if (!InitApp(hThisInst, nWinMode))
return (FALSE);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
BOOL InitApp(HINSTANCE hThisInst, int nWinMode)
{
WNDCLASSEX wc;
wc.hInstance = hThisInst;
wc.lpszClassName = szWinName;
wc.lpfnWndProc = WinProc;
wc.style = 0;
wc.cbSize = sizeof(WNDCLASSEX);
wc.hIcon = LoadIcon(hThisInst, IDI_APPLICATION);
wc.hIconSm = LoadIcon(hThisInst, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
if (!RegisterClassEx(&wc)) return (FALSE);
hWnd = CreateWindowEx(
0,
szWinName,
"Skeleton 背景を黒に",
WS_OVERLAPPEDWINDOW,
0,
0,
640,
480,
NULL,
NULL,
hThisInst,
NULL
);
ShowWindow(hWnd, nWinMode);
UpdateWindow(hWnd);
return (TRUE);
}
|