The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: vadiu on December 17, 2005, 07:54:33 PM

Title: filtering edit control input
Post by: vadiu on December 17, 2005, 07:54:33 PM
I'm using some edit controls in a program, and I would like them to just receive numbers 0-9. How can I throw away letters and other characters? Do I have to take care of a windows message?
Title: Re: filtering edit control input
Post by: MichaelW on December 17, 2005, 08:18:22 PM
http://www.masmforum.com/simple/index.php?topic=540.0

Title: Re: filtering edit control input
Post by: hutch-- on December 18, 2005, 02:49:52 PM
vadiu,

Same comment as I made in the thread that Michael has located for you, learn how to write a subclass for the edit control and the rest is easy. Process the WM_CHAR message in the subclass and return ZERO for any keys you don't want. For the 0123456789 that you require, you also need the backspace and the rest you just throw away.

If you have MASM32 there is a tool on the code menu for creating a subclass for controls which takes the hack work out of what you want to do.
Title: Re: filtering edit control input
Post by: farrier on December 18, 2005, 06:17:55 PM
vadiu,

Look at Iczelions Tutorial # 20

hth,

farrier
Title: Re: filtering edit control input
Post by: vadiu on December 18, 2005, 08:04:16 PM
Yep, I've read it.  :U Thanks. But now I have another question.
I'm using resources. So, how can I get a control handle given its ID?
Title: Re: filtering edit control input
Post by: petezl on December 19, 2005, 12:33:44 AM
Win32sdk
Search for GetDlgItem
Peter.