My button is setup like this :
Code:
void Setup_Button (Window* window, Button & button, char const * caption, int x, int y, int width, int height, int bitmap, DWORD exStyle)
{
button._style = WS_CHILD | WS_VISIBLE | SS_BITMAP | SS_NOTIFY;
button._caption = caption;
button._exStyle = exStyle;
button._x = x; // horizontal position of Button
button._y = y; // vertical position od Button
button._width = width; // Button width
button._height = height; // Button height
button._hWndParent = window->hWnd; // handle to parent or owner Button
button._data = 0; // pointer to Button-creation data
button.image = LoadBitmap(window->init.application->hInstance, (LPCSTR)bitmap);
Create_Button(window, button);
}
HWND Create_Button (Window* window, Button & button)
{
button.hwnd = ::CreateWindowEx (
button._exStyle,
"STATIC",
button._caption,
button._style,
button._x,
button._y,
button._width,
button._height,
button._hWndParent,
NULL,
window->init.application->hInstance,
button._data);
if (button.hwnd == 0)
TerminateApplication(window);
LRESULT lResult = SendMessage(button.hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)button.image);
return button.hwnd;
}
and I need to be able to catch the click events of that so i need a way of giving it an ID or anything else that would mean I could catch it in WM_COMMAND