Code:
#include <windows.h>
#include "Bitmap.h"
HINSTANCE hinst;
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
char szClassName[ ] = "Skeleton";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd;
MSG messages;
WNDCLASSEX wincl;
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure;
wincl.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
wincl.cbSize = sizeof (WNDCLASSEX);
wincl.hIcon = LoadIcon (NULL, IDI_HAND);
wincl.hIconSm = LoadIcon (NULL, IDI_WARNING);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
if (!RegisterClassEx (&wincl))
return 0;
hwnd = CreateWindowEx (
0,
szClassName,
"Skeleton",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hThisInstance,
NULL
);
while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc,hdcold;
HBITMAP Skull;
PAINTSTRUCT ps;
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
Skull = LoadBitmap(hinst, MAKEINTRESOURCE(IDB_BITMAP1));
hdcold = CreateCompatibleDC(hdc);
SelectObject(hdc, Skull);
BitBlt(hdc, 10, 10, 450, 400, hdcold, 0, 0, SRCCOPY);
DeleteDC(hdcold);
DeleteObject(Skull);
EndPaint(hwnd, &ps);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}