0

I have subclassed a CEdit control in order to handle some characters in a textbox.

void CRegistrationKeyEditBox::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{

    if (_istalpha(nChar))
        CEdit::OnChar(nChar, nRepCnt, nFlags);
}

I know i can get the string while handling the ON_CHANGE message but that wont work for me because i want to block some characters and not check for them if they are presented in the string.

When a text is pasted in the editbox i cant construct a CString from it. Is that possible? How can i view the whole string that is pasted in the textbox?

Alexander Demerdzhiev
  • 1,034
  • 2
  • 14
  • 29
  • What does `OnChar` have to do with pasting text? `WM_CHAR` message is sent when you type a single character on the keyboard; `nChar` parameter represents that character. `WM_CHAR` is not sent when you paste a block of text. What exactly are you trying to achieve? It's not at all clear from your problem statement. – Igor Tandetnik Apr 03 '15 at 14:26

1 Answers1

0

If you want to get the current content of the edit box, you could call GetWindowText().

For special handling of specific characters, this page goes into some detail: http://aclacl.brinkster.net/MFC/ch03d.htm