Author Topic: Key trapping in a Dialog Box  (Read 7027 times)

mcamember

  • Guest
Key trapping in a Dialog Box
« on: January 31, 2008, 03:37:04 PM »
If I code a dialog box using Microsoft MASM I can enter text from an EDIT control just by striking the Enter key ( as long as I have a
pushbutton defined as DEFPUSHBUTTON). The keyboard handling of the
internal Windows dialog callback (not *my* DlgWndProc ) will treat the
Enter key as if it were a mouse click on the pushbutton.

Not so in NASM.
In NASM I found that I must invoke IsDialogMessage inside of the
GetMessage code. I don't need to do anything with it except bypass
TranslateMessage and DispatchMessage if the message is from the dialog.

Is this intentional or is it a byproduct of some other goal ?
Thanks in advance
;mcamember

nobody

  • Guest
Re: Key trapping in a Dialog Box
« Reply #1 on: January 31, 2008, 08:01:31 PM »
This would be quite a trick for Nasm to pull off, would it not?

Nasm, presumably, is emitting what you wrote. Figure out what Masm's emitting, and you'll probably figure out what's going on.

Best,
Frank

nobody

  • Guest
Re: Key trapping in a Dialog Box
« Reply #2 on: February 01, 2008, 03:14:27 AM »
Settings in a resource file can affect this behaviour.  Are you using an ".rc" file in MASM but not in NASM?  What library/header package for NASM are you using?

http://del.icio.us/evenbit

mcamember

  • Guest
Re: Key trapping in a Dialog Box
« Reply #3 on: February 02, 2008, 12:22:44 PM »
Sorry for the delay in answering. It's due to
sleuthing and embarrassment - but mostly embarrassment.

I'm using NASM.EXE 0.98.39 1/16/05 and libraries from 08/13/07.

My embarrassment stems from the fact that I didn't notice one dialog was modal and the other was modeless (DialogBoxParam vs. CreateDialogParam)

Although I still can't get Windows to default the Enter key to
DEFPUSHBUTTON in modeLESS dialogs (without IsDialogMessage), NASM and MASM handle the same dialog functions in the same way.

The problem was in my own confusion. (Hard to believe, eh ?)

;mcamember