what can i do to use algorithim in window.h

Hi, I'm a beginner coder, I'm trying to make a calculator using windows.h. I manage to create all the buttons but I can't figure out how to implement integers or algorithms to solve for an integer. can someone explain this to me?
im using windows.h header file
[/code]
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_CREATE:

textfield = CreateWindow("STATIC",
"BoringCalculator",
WS_VISIBLE | WS_CHILD,
20, 50, 215, 45,
hwnd, NULL, NULL, NULL);
button = CreateWindow ("BUTTON", "1",
WS_VISIBLE | WS_CHILD | WS_BORDER,
20,100,50,20,
hwnd, (HMENU) 1, NULL, NULL);
button = CreateWindow ("BUTTON", "2",
WS_VISIBLE | WS_CHILD | WS_BORDER,
75,100,50,20,
hwnd, (HMENU) 2, NULL, NULL);
button = CreateWindow ("BUTTON", "3",
WS_VISIBLE | WS_CHILD | WS_BORDER,
130,100,50,20,
hwnd, (HMENU) 3, NULL, NULL);
button = CreateWindow ("BUTTON", "4",
WS_VISIBLE | WS_CHILD | WS_BORDER,
20,125,50,20,
hwnd, (HMENU) 4, NULL, NULL);
button = CreateWindow ("BUTTON", "5",
WS_VISIBLE | WS_CHILD | WS_BORDER,
75,125,50,20,
hwnd, (HMENU) 5, NULL, NULL);

button = CreateWindow ("BUTTON", "6",
WS_VISIBLE | WS_CHILD | WS_BORDER,
130,125,50,20,
hwnd, (HMENU) 6, NULL, NULL);
button = CreateWindow ("BUTTON", "7",
WS_VISIBLE | WS_CHILD | WS_BORDER,
20,150,50,20,
hwnd, (HMENU) 7, NULL, NULL);
button = CreateWindow ("BUTTON", "8",
WS_VISIBLE | WS_CHILD | WS_BORDER,
75,150,50,20,
hwnd, (HMENU) 8, NULL, NULL);
button = CreateWindow ("BUTTON", "9",
WS_VISIBLE | WS_CHILD | WS_BORDER,
130,150,50,20,
hwnd, (HMENU) 9, NULL, NULL);
button = CreateWindow ("BUTTON", "0",
WS_VISIBLE | WS_CHILD | WS_BORDER,
20,175,160,20,
hwnd, (HMENU) 0, NULL, NULL);
button = CreateWindow ("BUTTON", "+",
WS_VISIBLE | WS_CHILD | WS_BORDER,
185,100,50,20,
hwnd, (HMENU) 10, NULL, NULL);
button = CreateWindow ("BUTTON", "-",
WS_VISIBLE | WS_CHILD | WS_BORDER,
185,125,50,20,
hwnd, (HMENU) 11, NULL, NULL);
button = CreateWindow ("BUTTON", "*",
WS_VISIBLE | WS_CHILD | WS_BORDER,
185,150,50,20,
hwnd, (HMENU) 12, NULL, NULL);
button = CreateWindow ("BUTTON", "/",
WS_VISIBLE | WS_CHILD | WS_BORDER,
185,175,50,20,
hwnd, (HMENU) 13, NULL, NULL);
button = CreateWindow ("BUTTON", "=",
WS_VISIBLE | WS_CHILD | WS_BORDER,
20,200,215,20,
hwnd, (HMENU) 14, NULL, NULL);

textfield = CreateWindow("EDIT",
"History",
WS_VISIBLE | WS_CHILD,
250, 45, 300, 180,
hwnd, NULL, NULL, NULL);
break;

case WM_COMMAND:
{
if (LOWORD(wParam)== 1)
{
a = 1;
}

if (LOWORD(wParam)== 2)
{
a = 2;
}

if (LOWORD(wParam)== 3)
{
a = 3;
}

if (LOWORD(wParam)== 4)
{
a = 4;
}

if (LOWORD(wParam)== 5)
{
a = 5;
}

if (LOWORD(wParam)== 6)
{
a = 6;
}

if (LOWORD(wParam)== 7)
{
a = 7;
}

if (LOWORD(wParam)== 8)
{
a = 8;
}

if (LOWORD(wParam)== 9)
{
a = 9;
}

if (LOWORD(wParam)== 0)
{
a = 0;
}

break;
}



case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
default: /* for messages that we don't deal with */
return DefWindowProc (hwnd, message, wParam, lParam);
}

return 0;
}
Last edited on
Topic archived. No new replies allowed.