I wanna change button colors when the user click on it.
The main plan is: every month 10th one worker's button go to red and if the worker done his job then click on the button and it going to be green.
I have no idea what to do.
I already have this code... I just created a window and add a button to it:
#include <windows.h>
LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
void AddButton(HWND hwnd);
LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT msg, WPARAM wp,
LPARAM lp)
{
switch (msg) {
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CREATE:
AddButton(hWnd);
break;
default:
return DefWindowProcW(hWnd, msg, wp, lp);
}
}
void AddButton(HWND hWnd)
{
CreateWindowW(L"Button", L"Change colors", WS_VISIBLE | WS_CHILD,
350, 200,
100, 100,
hWnd,
NULL,
NULL,
NULL);
}
What I have tried:
So I tried WM_LBUTTONDOWN... so i think this is something when the user click on the button the program will do something. i put in the switch(msg) case WM_LBUTTONDOWN:
but no idea what's next