News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GetDlgItemText

Started by ragdog, January 27, 2008, 10:45:53 PM

Previous topic - Next topic

ragdog

hi guys

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

greets
ragdog

ragdog

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

jdoe

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



ragdog

thanks for your reply

   
If I use when I get compile this error message:

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

jdoe

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


ragdog

Thanks this works :U

best regard
ragdog