The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on January 27, 2008, 10:45:53 PM

Title: GetDlgItemText
Post by: ragdog on January 27, 2008, 10:45:53 PM
hi guys

I have a question about GetDlgItemText!
How can I check if a valid number or  a valid letter ?

greets
ragdog
Title: Re: GetDlgItemText
Post by: ragdog on January 27, 2008, 11:54:54 PM
i have this found

this works


                invoke GetDlgItemText,hWnd,1002,addr lpBuffer,10
                mov ebx,offset lpBuffer
               
                 .if (byte ptr [ebx] >= '0' && byte ptr [ebx] <= '9' )
                     invoke MessageBox,hWnd,addr szValid,0,MB_OK
                   .else
                   invoke MessageBox,hWnd,addr szInvalid,0,MB_OK
                 .endif




Why does this not work??


                invoke GetDlgItemText,hWnd,1002,addr lpBuffer,10
                mov ebx,offset lpBuffer
               
                     .if (byte ptr [ebx] >= '0' && byte ptr [ebx] <= '9' && byte ptr [ebx] >= 'A' && byte ptr [ebx] <= 'Z')
                     invoke MessageBox,hWnd,addr szValid,0,MB_OK
                   .else
                   invoke MessageBox,hWnd,addr szInvalid,0,MB_OK
                 .endif





thanks in forward
Title: Re: GetDlgItemText
Post by: jdoe on January 28, 2008, 01:24:09 AM
ragdog,

Look closer...


X = '2'

if (X >= '0' and X <= '9' and X >= 'A' and X <= 'Z')
    ; do this
endif


Should be..


X = '2'

if (X >= '0' and X <= '9') or (X >= 'A' and X <= 'Z')
    ; do this
endif


Title: Re: GetDlgItemText
Post by: ragdog on January 28, 2008, 01:31:08 AM
thanks for your reply

   
If I use when I get compile this error message:

error A2154: syntax error in control-flow directive :'(
Title: Re: GetDlgItemText
Post by: jdoe on January 28, 2008, 01:35:25 AM
Quote from: ragdog on January 28, 2008, 01:31:08 AM

If I use when I get compile this error message:

error A2154: syntax error in control-flow directive :'(


Did you took what I wrote as it is   :eek

It was pseudo code. The MASM code is...


.if (byte ptr [ebx] >= '0' && byte ptr [ebx] <= '9') || (byte ptr [ebx] >= 'A' && byte ptr [ebx] <= 'Z')



:bdg

Title: Re: GetDlgItemText
Post by: ragdog on January 28, 2008, 10:14:20 AM
Thanks this works :U

best regard
ragdog