chrishowarth
July 5th, 2007, 11:54 AM
Hello ~
I am trying to store the value returned from an Edit Box using GetDlgItemText. I retrieve the data from the Edit Box and store it to a character array. However, this does not seem to be returning anything! I also think that there must be a more efficient way of doing this, especially as I have to guess the maximum amount of characters the user enters when creatign the array. Here is the code:
char bColour [8]; //Border Colour
int bWidth [5]; //Border Width
char mFont [60]; //Menu Font
char hBgColour [8]; //Header Bg Colour
char hColour [8]; //Header Colour
char onBgColour [8]; //Hover Bg Colour
char offBgColour [8]; //noHover Bg Colour
char onColour [8]; //Hover Colour
char offColour [8]; //noHover Colour
int mPad[8]; //Header Colour
char bgImage [60]; //(Optional) Bg Image
char sepColour [8]; //Separator Colour
int sepSize; //Separator Size
char subImage [8]; //SubImage (little arrow thing)
int subImagePad; //SubImage Padding
...
case IDOK:
{
GetDlgItemText(HDlgStyle, ED_BCLR, bColour, sizeof(bColour));
// TODO (Christopher#5#): Function returns string; but needs to return an integer.
//GetDlgItemText(HDlgStyle, ED_BWDTH, bWidth, sizeof(bWidth));
GetDlgItemText(HDlgStyle, ED_FNT, mFont, sizeof(mFont));
GetDlgItemText(HDlgStyle, ED_HBGCLR, hBgColour, sizeof(hBgColour));
GetDlgItemText(HDlgStyle, ED_HCLR, hColour, sizeof(hColour));
GetDlgItemText(HDlgStyle, ED_ONBGCLR, onBgColour, sizeof(onBgColour));
GetDlgItemText(HDlgStyle, ED_OFFBGCLR, offBgColour, sizeof(offBgColour));
GetDlgItemText(HDlgStyle, ED_ONCLR, onColour, sizeof(onColour));
GetDlgItemText(HDlgStyle, ED_OFFCLR, offColour, sizeof(offColour));
// TODO (Christopher#5#): Function returns string; but needs to return an integer.
//GetDlgItemText(HDlgStyle, ED_PADDING, mPad, sizeof(mPad));
GetDlgItemText(HDlgStyle, ED_BGIMAGE, bgImage, sizeof(bgImage));
GetDlgItemText(HDlgStyle, ED_SEPCLR, sepColour, sizeof(sepColour));
// TODO (Christopher#5#): Function returns string; but needs to return an integer.
//GetDlgItemText(HDlgStyle, ED_SEPSIZE, sepSize, sizeof(sepSize));
GetDlgItemText(HDlgStyle, ED_SUBIMG, subImage, sizeof(subImage));
// TODO (Christopher#5#): Function returns string; but needs to return an integer.
//GetDlgItemText(HDlgStyle, ED_SUBPAD, subImagePad, sizeof(subImagePad));
}
MessageBox(GetActiveWindow(), onBgColour, "onBgColour", MB_OK | MB_ICONINFORMATION);
What is wrong?
Thanks;
Christopher Howarth
I am trying to store the value returned from an Edit Box using GetDlgItemText. I retrieve the data from the Edit Box and store it to a character array. However, this does not seem to be returning anything! I also think that there must be a more efficient way of doing this, especially as I have to guess the maximum amount of characters the user enters when creatign the array. Here is the code:
char bColour [8]; //Border Colour
int bWidth [5]; //Border Width
char mFont [60]; //Menu Font
char hBgColour [8]; //Header Bg Colour
char hColour [8]; //Header Colour
char onBgColour [8]; //Hover Bg Colour
char offBgColour [8]; //noHover Bg Colour
char onColour [8]; //Hover Colour
char offColour [8]; //noHover Colour
int mPad[8]; //Header Colour
char bgImage [60]; //(Optional) Bg Image
char sepColour [8]; //Separator Colour
int sepSize; //Separator Size
char subImage [8]; //SubImage (little arrow thing)
int subImagePad; //SubImage Padding
...
case IDOK:
{
GetDlgItemText(HDlgStyle, ED_BCLR, bColour, sizeof(bColour));
// TODO (Christopher#5#): Function returns string; but needs to return an integer.
//GetDlgItemText(HDlgStyle, ED_BWDTH, bWidth, sizeof(bWidth));
GetDlgItemText(HDlgStyle, ED_FNT, mFont, sizeof(mFont));
GetDlgItemText(HDlgStyle, ED_HBGCLR, hBgColour, sizeof(hBgColour));
GetDlgItemText(HDlgStyle, ED_HCLR, hColour, sizeof(hColour));
GetDlgItemText(HDlgStyle, ED_ONBGCLR, onBgColour, sizeof(onBgColour));
GetDlgItemText(HDlgStyle, ED_OFFBGCLR, offBgColour, sizeof(offBgColour));
GetDlgItemText(HDlgStyle, ED_ONCLR, onColour, sizeof(onColour));
GetDlgItemText(HDlgStyle, ED_OFFCLR, offColour, sizeof(offColour));
// TODO (Christopher#5#): Function returns string; but needs to return an integer.
//GetDlgItemText(HDlgStyle, ED_PADDING, mPad, sizeof(mPad));
GetDlgItemText(HDlgStyle, ED_BGIMAGE, bgImage, sizeof(bgImage));
GetDlgItemText(HDlgStyle, ED_SEPCLR, sepColour, sizeof(sepColour));
// TODO (Christopher#5#): Function returns string; but needs to return an integer.
//GetDlgItemText(HDlgStyle, ED_SEPSIZE, sepSize, sizeof(sepSize));
GetDlgItemText(HDlgStyle, ED_SUBIMG, subImage, sizeof(subImage));
// TODO (Christopher#5#): Function returns string; but needs to return an integer.
//GetDlgItemText(HDlgStyle, ED_SUBPAD, subImagePad, sizeof(subImagePad));
}
MessageBox(GetActiveWindow(), onBgColour, "onBgColour", MB_OK | MB_ICONINFORMATION);
What is wrong?
Thanks;
Christopher Howarth