Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX editbox

Status
Not open for further replies.

Jiko

Technical User
Apr 5, 2002
35
SE
We want to do an ActiveX editbox that keep track on the number of characters written. We have done one that count the characters (m_nCharsTyped). It works well until we select more than one character and press backspace ('\b'), then m_nCharsTyped is just decreased by one.


void CNummerCtrl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default

if(nChar == '\b' && m_nCharsTyped > 0){
COleControl::OnChar(nChar, nRepCnt, nFlags);
m_nCharsTyped--;
}
else if(m_nCharsTyped >= m_MaxNumberofCharacters)
DoErrorAction();
else if(nChar>='0' && nChar<='9'){
COleControl::OnChar(nChar, nRepCnt, nFlags);
m_nCharsTyped++;
}
else
DoErrorAction();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top