Tekil Mesaj gösterimi
C programinizda eski win 3.1 pencere sistemi kullanin
Alt
  (#1)
The-Queen is Offline
[10]Yeni Üye
 
The-Queen - ait Kullanıcı Resmi (Avatar)
 
Mesaj Sayısı: 68
Açtığı Konu: 30

Level: 7 [♥ Bé-Yêu ♥♥ Bé-Yêu ♥♥ Bé-Yêu ♥♥ Bé-Yêu ♥♥ Bé-Yêu ♥]
Paylaşım: 0 / 153
Güç: 22 / 767
Tecrübe: 15%

Üyelik tarihi: Apr 2007
Kullanıcı No: 8207
Tecrübe Puanı: 24
REP Puanı : 100
REP Seviyesi : The-Queen will become famous soon enoughThe-Queen will become famous soon enough
   
Standart C programinizda eski win 3.1 pencere sistemi kullanin - 05-01-2007


#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, "Yazılımcı", -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;
}
  
Alıntı ile Cevapla