1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#define STRICT
#include<windows.h>
HGDIOBJ GetStockObject(int iObject);
const char szAppName[] = "Ein eigenes Fenster";
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE,PSTR szCmdLine,int iCmdShow)
{
HWND hWnd;
MSG msg;
WNDCLASS wc;
wc.style = CS_HREDRAW|CS_VREDRAW;
wc.lpfnWndProc=WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszClassName = szAppName;
wc.lpszMenuName = NULL;
RegisterClass (&wc);
hWnd = CreateWindow(szAppName,
"Titteleiser",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, // x Pos
CW_USEDEFAULT, // y pos.
CW_USEDEFAULT, // Breite
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hWnd,iCmdShow);
UpdateWindow(hWnd);
while(GetMessage(&msg,0,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
} return DefWindowProc(hWnd, message, wParam, lParam);
}
|