Programalama > C++

Etiketler: nostalji, ekranlar

Ort. 0
Puan ver:
#include <windows.h>
#include <string.h>
#include <iostream>
LRESULT CALLBACK
MainWndProc (HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
static HWND hwndButton = 0;
static int cx, cy;

HDC hdc;
PAINTSTRUCT ps;
RECT rc;
switch (nMsg)
{
case WM_CREATE:
{
TEXTMETRIC tm;


hdc = GetDC (hwnd);
SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT));
GetTextMetrics (hdc, &tm);
cx = tm.tmAveCharWidth * 30;
cy = (tm.tmHeight + tm.tmExternalLeading) * 2;
ReleaseDC (hwnd, hdc);


hwndButton = CreateWindow (
"button",
"Anladık be",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, cx, cy,
hwnd,
(HMENU) 1,
((LPCREATESTRUCT) lParam)->hInstance,
NULL
);

return 0;
break;
}

case WM_DESTROY:
PostQuitMessage (0);
return 0;
break;

case WM_PAINT:
hdc = BeginPaint (hwnd, &ps);
GetClientRect (hwnd, &rc);


rc.bottom = rc.bottom / 2;
DrawText (hdc, "HazirKod.Com Türkiye'nin Hazır Kod Arşivi", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);

EndPaint (hwnd, &ps);
return 0;
break;

case WM_SIZE:
if (hwndButton &&
(wParam == SIZEFULLSCREEN ||
 wParam == SIZENORMAL)
   )
{
rc.left = (LOWORD(lParam) - cx) / 2;
rc.top = HIWORD(lParam) * 3 / 4 - cy / 2;
MoveWindow (
hwndButton,
rc.left, rc.top, cx, cy, TRUE);
}
break;

case WM_COMMAND:
if (LOWORD(wParam) == 1 &&
    HIWORD(wParam) == BN_CLICKED &&
    (HWND) lParam == hwndButton)
{
DestroyWindow (hwnd);
}
return 0;
break;
}


return DefWindowProc (hwnd, nMsg, wParam, lParam);
}


int STDCALL
WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
{
HWND hwndMain;
MSG msg;
WNDCLASSEX wndclass;
char*szMainWndClass = "WinTestWin";

memset (&wndclass, 0, sizeof(WNDCLASSEX));


wndclass.lpszClassName = szMainWndClass;


wndclass.cbSize = sizeof(WNDCLASSEX);


wndclass.style = CS_HREDRAW | CS_VREDRAW;


wndclass.lpfnWndProc = MainWndProc;


wndclass.hInstance = hInst;


wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);


wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);


RegisterClassEx (&wndclass);


hwndMain = CreateWindow (
szMainWndClass,
"Pencere::Hazirkod",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInst,
NULL
);


ShowWindow (hwndMain, nShow);
UpdateWindow (hwndMain);


while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.