"Reece Dunn" msclrhd@googlemail.com writes:
-typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc); +/* These are indices into a states array to determine the theme state for a given theme part. */ +#define STATE_NORMAL 0 +#define STATE_DISABLED 1 +#define STATE_HOT 2 +#define STATE_PRESSED 3 +#define STATE_DEFAULTED 4
An enum would be nicer.
+static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, int drawState, UINT dtFlags) +{
- static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED };
- RECT bgRect, textRect;
- HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
- HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
- int state = states[ drawState ];
- WCHAR text[MAX_PATH];
- int len = MAX_PATH;
MAX_PATH is not appropriate for a button text, this has nothing to do with a path. You should define your own constant, though dynamic allocation would of course be preferable.