locked
strchr() works/doesn't work RRS feed

  • Question

  • Regarding the text in my edit control, I get the text, make sure there's no decimal in it, and if there is, don't put another one in there, according to the following...

    GetDlgItemText(hwnd, ID_EDIT, chSetNum, MAXNUM);
    if(strchr(chSetNum, '.') == NULL)
       strcat_s(chSetNum, MAXNUM, szPeriod);

    ...which works fine if I use a number pad that I've created in the dialog and placed beside the edit control, which can be clicked with the mouse, but when I press the decimal key, either on the regular keyboard or on the keyboard number pad, it doesn't prevent more decimals from showing up in the edit control.

    Another simple task that becomes not so simple. Can someone please explain why this is so, and how do I get around it?
    Lamblion
    • Edited by Lamblion Thursday, July 30, 2009 8:31 PM
    Thursday, July 30, 2009 8:29 PM

Answers

All replies