Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button colours using CreateDialogIndirect()

Status
Not open for further replies.

Daih

Programmer
Dec 13, 2004
7
GB
Hi,

I'm using CreateDialogIndirect() to display a dialog, and using the code below to set up a button.
I'd like to specify the colour of the button - does anyone know how?

This would really help me, so thanks in advance to anyone who can help.
Cheers,
Daih

AlignToDblWordBoundary (&p);
Style = WS_VISIBLE | WS_TABSTOP;
*p++ = LOWORD (Style);
*p++ = HIWORD (Style);
/* Specify lo-word and hi-word of the extended style of the button, which we won't use. */
*p++ = 0;
*p++ = 0;
/* Then coordinates. */
*p++ = x;
*p++ = y;
*p++ = width;
*p++ = height;
/* Then the id of the button, e.g. IDC_ABORT, so when it's pressed we know which one it was. */
*p++ = Id;
*p++ = 0xFFFF; /* Specifies that the next value will specify what this item is, e.g. button, text etc. */
*p++ = 0x0080; /* Specifies this item is a button. */
/* The text on the button, e.g. "Abort". */
WriteWideCharsAndInc (wpp, Caption);
/* Set a value specifying some extra stuff which we don't use. */
*p++ = 0;
 
As far as I know, you have to make it an owner-draw button and do the painting yourself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top