int q = 0;
HWND static_wnd = NULL;
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
char i[10];
wsprintf(i, _T("%d"), q);
switch (message) {
case WM_CREATE:
CreateWindow(_T("button"), _T("òðóäíà"),
WS_VISIBLE | WS_CHILD,
120, 170, 100, 25,
hWnd, (HMENU)ID_BUTTON, NULL, NULL);
static_wnd = CreateWindow(_T("static"), i,
WS_VISIBLE | WS_CHILD | WS_BORDER,
5, 5, 370, 50,
hWnd, NULL, NULL, NULL);
break;
case WM_COMMAND:
if (LOWORD(wParam == ID_BUTTON)) {
q++;
wsprintf(i, _T("%d"), q);
SetWindowText(static_wnd, i);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
break;
}
return 0;
}