The MFC Professional Stingray Software

MFC FAQ SNEAK PEEK #1
Our exclusive preview of Scot Wingo's upcoming additions


Ta-da!!!!! Scot Wingo's FAQ Sneak Peek is finally making its debut! Read his introduction, and then take a look at the tip below. We've got some incriminating pictures of Scot, so you can rest easy in the knowledge that the tips will be flowing on a regular basis now -- at least one new tip every week, usually more. Look for the next tip on Thursday. Enjoy!

Q. How do I filter characters in a CEdit?

A. Create a CEdit derivative (CMyEdit) and create an OnChar() message map entry.


   // Assume that CMyEdit is derived from the CEdit class.

   afx_msg void CMyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
   {
      if (nChar == 'a' || nChar == 'A')
      {
          nChar = 'X';
      }
      DefWindowProc(WM_CHAR, nChar, MAKELONG(nRepCnt, nFlags));
   }

--Source Unknown



This tip is provided for instructional purposes, and is released to the public domain. No claim of ownership is made. Use it at your own risk. No warranties are expressed or implied. The resulting program may not be fully functional. No animals were harmed in the making of this tip.


Comments? Speak up!

| Past FAQ Tips | Latest FAQ Document | Home |