Hi to all :)

Well, long time I read this board, and found it very very interesting for my programs, the particularity is that a lot of answers have been posted with examples, make us programming & understing easier ^^

Pretty, but in this time I've got a ( very ) stupid problem.

I'm trying to compare two numbers, which are port numbers. So, the first member ( setted by user ) will not be greater than 65535 ( constant in the program ). The first number is entered as a word, as the second. I've tried the function

The explanation is this : When I enter a number like 1015, the number is accepted ( Yeeha ! ), I enter 65534 the number is okay ( Youhoo ! ), I enter 7, don't work. This is because 7 is greater than 6, first number of 65535, so the program tell "Hey, but this is greater ! Stop this !" ?_? In fact, these function check first number with first number, so 7 is compared to 6, that's the prob'.

Now, there is the question ( Huhu, ther's always a question ^^' ) :

How can I resolve this ?

CMP doesn't seems to work, I don't know why .. :/

Thanks for all your answers, even if this is 'You have a big nose" O_o

Waiting for your help, hopin I'll find my answer here .. ^^'

Well, long time I read this board, and found it very very interesting for my programs, the particularity is that a lot of answers have been posted with examples, make us programming & understing easier ^^

Pretty, but in this time I've got a ( very ) stupid problem.

I'm trying to compare two numbers, which are port numbers. So, the first member ( setted by user ) will not be greater than 65535 ( constant in the program ). The first number is entered as a word, as the second. I've tried the function

**lstrcmp, lstrcmpi, CompareString, CMP**, but none work like I want.The explanation is this : When I enter a number like 1015, the number is accepted ( Yeeha ! ), I enter 65534 the number is okay ( Youhoo ! ), I enter 7, don't work. This is because 7 is greater than 6, first number of 65535, so the program tell "Hey, but this is greater ! Stop this !" ?_? In fact, these function check first number with first number, so 7 is compared to 6, that's the prob'.

Now, there is the question ( Huhu, ther's always a question ^^' ) :

How can I resolve this ?

CMP doesn't seems to work, I don't know why .. :/

Thanks for all your answers, even if this is 'You have a big nose" O_o

Waiting for your help, hopin I'll find my answer here .. ^^'

You should do the comparisons as integers, not string values. When you get the number from the user, you could use for instance GetDlgItemInt instead of GetDlgItemText - or you could use something like a2dw from the masm32 library to convert the string to an integer.

Whups. Stupid question ^^

Hm, well, working perfectly ^^'

Problem solved, thanks a veryyyyy lot f0dder :D

*rush to program*

Hm, well, working perfectly ^^'

Problem solved, thanks a veryyyyy lot f0dder :D

*rush to program*