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
|
//at the top of the page with all the szClass and LRESULT stuff
HWND button;
int a, b;
//at the bottom with the switch(message)
switch(message)
{
case WM_CREATE:
button = CreateWindow("BUTTON",
"1",
WS_VISIBLE | WS_BORDER | WS_CHILD,
50, 20, 40, 40,
hwnd, (HMENU) 1, NULL, NULL);
button = CreateWindow("BUTTON",
"2",
WS_VISIBLE | WS_BORDER | WS_CHILD,
50, 60, 40, 40,
hwnd, (HMENU) 2, NULL, NULL);
textbox = CreateWindow("EDIT",
a + b,
WS_VISIBLE | WS_BORDER | WS_CHILD,
50, 100, 100, 40,
hwnd, (HMENU) 3, NULL, NULL);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case 1:
a = 1;
break;
case 2:
b = 2;
break;
case 3:
a+b;
}
break;
case WM_DESTROY: /* send a WM_QUIT to the message queue */
PostQuitMessage(0);
break;
|