News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

windows messages

Started by ninjarider, August 19, 2005, 03:19:38 PM

Previous topic - Next topic

ninjarider

would the following code be correct
wndproc ...
...
.elseif umsg==WM_KEYDOWN
  mov kd[wParam], 1
.elseif umsg==WM_KEYUP
  mov kd[wParam], 0
.endif

Tedd

The logic is okay.
The instructions are a little off though. But I assume it's meant to be just pseudo code :wink
No snowflake in an avalanche feels responsible.

czDrillard

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

ninjarider

when u clear eax does that tell widows that the message has been handled. or is that just good ethics

roticv


Mark Jones

Be sure to look up WM_KEY* in the WIN32.HLP file. This will tell you all you need to know. :)
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

QvasiModo

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.

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php