GetDlgItemInt() question?

Recently I asked about getting TEXT from an edit box, but now I need to get an integer from it. See, I can't check if I am actually getting the text from the box, because I can't pass an integer to a messagebox or static. I assume I have to use GetDlgItemInt()? Anyhelp would be appreciated
do get number from edit box use GetDlgItemInt or GetDlgItemText and then later convert text to number manually, for example with _ttoi.

ps. Also if EDIT field should only be able to hold numbers, use it with ES_NUMBER style so you wont need to check for wrong input value later.

Okay, well thanks so far, but I am trying to multiply the input of hEdit (the edit box) by 6, no reason behind it, just trying it, and it says "invalid operands of types 'char*' and 'int' to binary 'operator*'" Any idea on how to fix that?
Exactly like tath said, edit controls don't hold numeric values. Yes, you can write a '6' to an edit control. But what the underlying text buffer is really holding isn't the number '6', but the text representation of it as an asci code, which off the top of my head I believe is decimal 56. So you need to do what tath said, use _ttoi or atoi or wtoi or whatever to take an asci or wide character representation of the number, and convert that to its binary equivalent in terms of int, long, or whatever. And only that can be multiplied. If you add asci 2 to asci 2 you are doing a string concatenation, and the result isn't 4 but rather 22. Get it???
Well, mixing GetDlgItemInt and using atoi() is nonsense, why you don't use an int directly ?
Topic archived. No new replies allowed.