I only get errors when I try:
itoa(color, text, 10);
But I can convert the DWORD value into float! But the text change color into black instead of the chosen color when I press the Return Key:
#include <DarkGDK.h>
#include "Windows.h"
CHOOSECOLOR cc; // common dialog box structure
static COLORREF acrCustClr[16]; // array of custom colors
HBRUSH hbrush; // brush handle
static DWORD rgbCurrent; // initial color selection
DWORD SelectColor()
{
// Initialize CHOOSECOLOR
ZeroMemory(&cc, sizeof(cc));
cc.lStructSize = sizeof(cc);
cc.hwndOwner = NULL;
cc.lpCustColors = (LPDWORD) acrCustClr;
cc.rgbResult = rgbCurrent;
cc.Flags = CC_FULLOPEN | CC_RGBINIT;
if (ChooseColor(&cc)==TRUE)
{
hbrush = CreateSolidBrush(cc.rgbResult);
rgbCurrent = cc.rgbResult;
}
return rgbCurrent;
}
void DarkGDK()
{
dbSyncOn();
dbInk(dbRGB(255, 255, 255), 0);
DWORD color = SelectColor();
while(LoopGDK())
{
if(dbReturnKey() == 1)
{
dbInk(color, 0);
dbCLS();
}
dbText(0, 0, dbStr((float)color));
dbSync();
}
}