Hi folks - me again with another dumb question I guess.....

What I have is a value entered by the user into an edit box (for example "1007") which I need to convert to an integer double word value so I can use it in my program.

Is there an API call that would read an integer value rather than a string from the edit control? - I can't find one so far

Can I use C runtime library routines like strtol or atoi in my asm programs? What do I need to include to allow me to call these routines. In C I can see these routines are in stdlib.h

Thanks again - sorry if this is dumb but some of us still have to learn from the beginning  ;)

dicky
Posted on 2005-10-04 17:29:00 by dicky96
dicky,

If you are using MASM32 and you have the later updates, you can call any of the MSVCRT functions and they work fine.
Posted on 2005-10-04 17:52:15 by hutch--
I normally have such edit controls within a dialog box. I would then use GetDlgItemInt.

Raymond
Posted on 2005-10-04 19:55:01 by Raymond
Dicky, you can use C runtime libraries just fine - either with a recent MASM32 which will use msvcrt.dll if I'm not mistaken, or by linking directly with the libc that came with your compiler (you'll have to write up prototypes etc. manually then, but have the advantage(?) of a statically linked libc).

The caveat with static linkage is that, unless you use a standard "main" function, not *everything* will work, because the libc initialization code hasn't been called (str* functions will work, FILE* routines might not).

As for getting integer from a textbox, have a look at GetDlgItemInt if you're using dialogs.

Oh, and you might want to have a look at WCRT from http://www.ibsensoftware.com , it's a rather nice minimal-overhead libc.
Posted on 2005-10-04 19:58:15 by f0dder
I second Raymond's statement.

Darrel
Posted on 2005-10-04 21:53:10 by Darrel
Appearantly so did I - but Raymond posted while I was still writing :)

Btw I'd advice against anything using msvcrt.dll as it has known bugs wrt. FILE* streams.
Posted on 2005-10-04 21:58:18 by f0dder
Yes you did f0dder.  8)

I did notice the time of your posts and assumed you were both replying at the same time and should have said "I agree with Raymond's statements." since you did second him before me. :D

Regards,
Darrel
Posted on 2005-10-04 22:10:16 by Darrel
Yeah I'm using my edit controls in a Dialog so GetDlgItemInt is what I was looking for - I thought I had seen something like that somewhere - but last night I was looking through all the EM_ messages I could send to the text box and could not find what I wanted - it always helps when u look in the right place  :shock:

Thanks for the advice on using C runtime libraries as well - I'll leave that till when I need it  ;)

dicky
Posted on 2005-10-05 03:52:13 by dicky96