i should know this by now.:stupid:
invoke GetMessage,ADDR msg,NULL,0,0
.break .if (!eax)
;do something
im having trouble understanding what the .if (!eax) part. to me it seems like .if not eax but this is still confusing if this is the case.
invoke GetMessage,ADDR msg,NULL,0,0
.break .if (!eax)
;do something
im having trouble understanding what the .if (!eax) part. to me it seems like .if not eax but this is still confusing if this is the case.
It does .break if eax is not equal to 0
So you could also write .break .if (eax != 0)
So you could also write .break .if (eax != 0)
Yes smurf that use to bother me also which leads me to another question. When you respond to a message it seems to me that if you want to do anything extraordinary you must create a thread. That is if you want to do anything graphical etc. In my opinion this makes your programming totally dependent on following the platform rules. Don't know why i'm even saying this...perhaps because its so hard to get information on heavy graphic stuff like Direct3d and opengl.
Stuck with coming up with new ideas for win32 i guess.
Stuck with coming up with new ideas for win32 i guess.
ok thank you. much better readable code.
this is very strange and i dont understand it. iczelion's MDI tutorial #32 uses the .if (!eax) in his message loop. if i change it to .if (eax != 0) it doesnt work. but if i change it to .if (eax == 0) it works. can somene explain this to me please. the direct link to his #32 source code is: http://spiff.tripnet.se/~iczelion/files/tut32.zip
im wondering if you might be mistaken. does !eax instead mean eax == 0?
im wondering if you might be mistaken. does !eax instead mean eax == 0?
Hmmm, i think the brackets may be confusing you a little. With these expressions:
This line:
Hope this helps :)
.if (eax != 0)
.if (eax == 0)
you don't actually need the brackets. In pseudo-speak, the IF statement can be said like this:IF <expression> IS TRUE THEN.....
So, with the above statements, they will get evaluated, and if the result is TRUE (which means != 0), then execution will continue with the next line.
This line:
.IF (!eax)
is slightly different, in pseudo it would read something like this: take the value of EAX, do a logical NOT on it, then if the new value of EAX is TRUE (i.e. !=0), then continue on next line
I use the .IF !eax quite a bit in my apps to test for a successful return from an API call, or to check for an unsuccessful call where i was supposed to be returned a handle in eax.
Hope this helps :)
smurf
What .if (!eax) means is if eax is zero then do something.
.if (eax) means if eax is true (non zero) then do something.
GetMessage returns non-zero untill it receives WM_QUIT so that code says to break as soon as GetMessage has received WM_QUIT
EDIT
it works like this
.if (expression)
The expresion will return either true or false if you do a ! (not) on something that is true it becomes false (zero)
What .if (!eax) means is if eax is zero then do something.
.if (eax) means if eax is true (non zero) then do something.
GetMessage returns non-zero untill it receives WM_QUIT so that code says to break as soon as GetMessage has received WM_QUIT
EDIT
it works like this
.if (expression)
The expresion will return either true or false if you do a ! (not) on something that is true it becomes false (zero)
so basically .if (!eax) is the same as .if eax == FALSE or .if eax == 0 thanks for clearing that up.
Ah sorry, I got a bit confused by that, even though I did know what it should mean :)