flat assembler
Message board for the users of flat assembler.

Index > Windows > edit control, user input & spaces

Author
Thread Post new topic Reply to topic
dacid



Joined: 31 Aug 2008
Posts: 57
dacid 19 Sep 2008, 10:01
i have an edit control where the user enter values with spaces:

11 25 0E 54 FF ...

I get the input with GetDlgItemText (data is in a buffeR) but how i can remove the spaces?

11250E54FF ...
Post 19 Sep 2008, 10:01
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 19 Sep 2008, 10:09
process string with your procedure
Post 19 Sep 2008, 10:09
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20445
Location: In your JS exploiting you and your system
revolution 19 Sep 2008, 10:41
Yes, indeed, there are no API functions that can do it for you, you will need to have your write your own procedure to scan the buffer and ignore/remove the spaces.
Post 19 Sep 2008, 10:41
View user's profile Send private message Visit poster's website Reply with quote
dacid



Joined: 31 Aug 2008
Posts: 57
dacid 19 Sep 2008, 16:22
ok Smile

i have another problem now, how i can validate user input to be betwen 0-9 & A-F ?

Some basic source code appreciated
Post 19 Sep 2008, 16:22
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 19 Sep 2008, 17:23
Code:
proc isValidChar char
  mov     dl, byte [char]
  movzx   eax, dl ; To clear upper 24 bits of EAX so at exit it will be either 0 or 1

  sub     dl, '0'
  sub     al, 'A'

  cmp     dl, 9
  setbe   dl

  cmp     al, 5
  setbe   al

  or      al, dl
  ret
endp    
Post 19 Sep 2008, 17:23
View user's profile Send private message Reply with quote
dacid



Joined: 31 Aug 2008
Posts: 57
dacid 19 Sep 2008, 18:13
thx
Post 19 Sep 2008, 18:13
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4071
Location: vpcmpistri
bitRAKE 20 Sep 2008, 01:01
Code:
isValidChar:
    label .char byte at esp+4

    movzx eax,[.char]
    bt [_0123456789ABCDEF],eax
    setc al
    retn 4

    align 32 ; only load a single cacheline
_0123456789ABCDEF dw \
  0000000000000000b,\
  0000000000000000b,\
  0000000000000000b,\
  0000001111111111b,\
  0000000001111110b,\
  0000000000000000b,\
  0000000000000000b,\
  0000000000000000b,\
  0000000000000000b,\
  0000000000000000b,\
  0000000000000000b,\
  0000000000000000b,\
  0000000000000000b,\
  0000000000000000b,\
  0000000000000000b,\
  0000000000000000b    

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 20 Sep 2008, 01:01
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.