Re: What does edit control send to parent window with WM_COMMAND?
From: Ken Wickes [MSFT] (kenwic_at_online.microsoft.com)
Date: 01/11/05
- Next message: Ken Wickes [MSFT]: "Re: WM_WINDOWPOSCHANGED WindowPos struct flags"
- Previous message: Riley DeWiley: "Re: What does edit control send to parent window with WM_COMMAND?"
- In reply to: Riley DeWiley: "Re: What does edit control send to parent window with WM_COMMAND?"
- Next in thread: Riley DeWiley: "Re: What does edit control send to parent window with WM_COMMAND?"
- Reply: Riley DeWiley: "Re: What does edit control send to parent window with WM_COMMAND?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 10 Jan 2005 18:50:49 -0800
What are you trying to accomplish?
If you want the edit control to insert a newline then ES_WANTRETURN will do
that.
I wouldn't really recommend changing the default dialog keyboard handling
(Enter means push default button).
But if you really want to then subclassing is the way to go.
--
Ken Wickes [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.
"Riley DeWiley" <riley.dewiley@gmail.com> wrote in message
news:la2dnTeceNDOq37cRVn-vw@seanet.com...
> Mercy. Thanks, I am sure that will do the job, but isn't there a simpler
> way? I see WM_COMMANDS sent to my dialog when I press ENTER, but don't
> know
> how to crack the wParams and lParams to filter out what I need.
>
> RDeW
>
> "AliR" <AliR@newsgroup.nospam> wrote in message
> news:3UEEd.14116$iC4.530@newssvr30.news.prodigy.com...
>> Here is how you would do that.
>>
>> Catch the message DM_GETDEFID, Beside other things, this gets called when
>> the enter key is pressed in a dialog box to get the default push buttons
> id.
>>
>> ON_MESSAGE(DM_GETDEFID,OnGetDefID)
>>
>> then within your OnGetDefID method check to see if the focus is on the
> edit
>> you are intrested in. Since DM_GETDEFID can get called for other things,
> you
>> will need to check to see if VK_RETURN is pressed at the time.
>>
>>
>> LRESULT CMyDlg::OnGetDefID(WPARAM,LPARAM)
>> {
>> if ((GetFocus()->m_hWnd == m_MyEdit.m_hWnd) && (0x8000 &
>> GetKeyState(VK_RETURN)))
>> {
>> MessageBox("Enter in My Edit");
>> return 0; //only do this if you don't want the default
>> push
>> button to get called
>> }
>> return Default(); //this lets the window do its default thing,
>> push
>> the default button in this case.
>> }
>>
>> AliR.
>>
>> "Riley DeWiley" <riley.dewiley@gmail.com> wrote in message
>> news:W9Odncj2TcuKiX7cRVn-3Q@seanet.com...
>> > I have a window with a child edit window. I wish to trap the <ENTER>
>> > key
>> > being pushed, when the focus is on the edit window. I want to do this
> from
>> > the parent window, without subclassing the edit window. Edit windows
> send
>> a
>> > WM_COMMAND to their parent when a carriage return is entered. Problem
> is,
>> > they send WM_COMMANDs every time plankton spawn in the Pacific Ocean.
>> >
>> > How do I filter out the WM_COMMANDs I want from all the chaff? I can't
>> find
>> > this in the docs.
>> >
>> > RDeW
>> >
>> >
>>
>>
>
>
- Next message: Ken Wickes [MSFT]: "Re: WM_WINDOWPOSCHANGED WindowPos struct flags"
- Previous message: Riley DeWiley: "Re: What does edit control send to parent window with WM_COMMAND?"
- In reply to: Riley DeWiley: "Re: What does edit control send to parent window with WM_COMMAND?"
- Next in thread: Riley DeWiley: "Re: What does edit control send to parent window with WM_COMMAND?"
- Reply: Riley DeWiley: "Re: What does edit control send to parent window with WM_COMMAND?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|