would the following code be correct
wndproc ...
...
.elseif umsg==WM_KEYDOWN
mov kd[wParam], 1
.elseif umsg==WM_KEYUP
mov kd[wParam], 0
.endif
The logic is okay.
The instructions are a little off though. But I assume it's meant to be just pseudo code :wink
Hi ninjarider,
Only thing I can add is don't forget to xor eax,eax and ret if your appĀ processes either one of these messages.
best regards,
czDrillard
when u clear eax does that tell widows that the message has been handled. or is that just good ethics
The former I believe.
Be sure to look up WM_KEY* in the WIN32.HLP file. This will tell you all you need to know. :)
Quote from: ninjarider on August 19, 2005, 07:30:44 PM
when u clear eax does that tell widows that the message has been handled. or is that just good ethics
The first, for most if not all window messages.
ninjarider,
When a windows message specifies "return 0" it literally means zero EAX then call a RET.
xor eax, eax
ret
Note that it is not normally required for message procesing but if you use a DlgProc, it requires that you clear EAX before the procedure ends. This is not the same as closing a DlgProc but if you don't clear EAX, you will get some strange display problems with a dialog.
You exit a normal WndProc with the return value from,
invoke DefWindowProc,hWin,uMsg,wParam,lParam
What is happening is that when a message requires a return value of ZERO you exit the WndProc BEFORE the Default processing where if you do a normal exit, you pass the default return value back to the OS.