News:

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

Interacting with the keyboard with edit window

Started by allynm, January 04, 2010, 07:21:58 PM

Previous topic - Next topic

allynm

Good morning JJ and everyone-

JJ -  I went to bed before receiving your comments on the code I sent along.  Anyway, I forgot to send along the menu resource file.  Sorry....of course that is why you wound up having to stick in the menu code.  Also, thanks for putting the gray area around the code.  I didn't know how to do that.  Now I do.

The code and your various improvements certainly sparked some interesting commentary.  I will try to digest it during the day today.

Regards to all,

Mark

Slugsnack

Hey no kidding man.. If you only wanna process the return key then you can forget subclassing and just use my method.. It's like 2 lines..

.ELSEIF uMsg == WM_COMMAND

mov eax, wParam

.ELSEIF ax == IDOK


And then if you want to..

invoke GetFocus

Then do a switch/case or if/elseif of the return.

allynm

Hi Slugsnack:

Thanks for the tip on this.  As it turns out, I want to process more than just the "Enter" key. 

You could help me on a couple of points with regard to the snippet you sent.

1.  Why the second "ELSEIF"?  Naively, I supposed that it would be just an .IF
2.  I know I have a lot to learn still, but I am still grappling with setting the focus at any particular window.  So, when you do the invoke of GetFocus, what are you doing, or think I might be doing.  I don't understand what GetFocus does, in short.

Thanks very much,
Mark

Slugsnack

1. this snippet should appear in your dialogproc. the first if filters all messages that are WM_COMMAND. the second one filters again, but this time only messages where the loword of wParam is IDOK.

this is wm_command:
http://msdn.microsoft.com/en-us/library/ms647591(VS.85).aspx

so now, assuming you don't also happen to have a control IDOK, all messages at this point are a result of hitting return.

2. when we are at the point mentioned above, sometimes we don't care what control is currently in focus but since the above message does not tell us where the enter was done from, we can find out what control is responsible for it by calling GetFocus(). that function will return the currently focused control. you can then conditionally execute code for particular cases

allynm

Hi Slugsnack -

I apologize for being a couple of days slow in getting back to you. 

Your last post was quite clear.  Gosh, I still have so much to learn.... 

Thanks for your help.

Mark