Re: What does edit control send to parent window with WM_COMMAND?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ken Wickes [MSFT] (kenwic_at_online.microsoft.com)
Date: 01/11/05


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
>> >
>> >
>>
>>
>
> 


Relevant Pages

  • Re: IDLE bug
    ... then I prefer that one ask here for a second opinion. ... I have been using IDLE more these days, ... prevented the save somehow before the edit window closed down. ... Open a new edit window with File --> New Window ...
    (comp.lang.python)
  • Re: Cant edit dynamically created textbox
    ... meaning that you can't push it behind the parent window or interact ... with the parent window until the dialog is closed. ... >> I've dynmaically created a textbox, but I can't edit it. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: What does edit control send to parent window with WM_COMMAND?
    ... deskbar band object; the edit window is created within my own band object ... I want to trap the entry of text in the edit control. ... >> RDeW ...
    (microsoft.public.win32.programmer.ui)
  • Re: Re-running script from Tk shell
    ... I edit and save the file from which I ... module from the Edit window. ... Try having your script first import the library and then reload it, ... It will load foo more slowly the first time (and a clever if statement ...
    (comp.lang.python)
  • Re: DLL hosted CFormView CWnds have an m_hWnd of 0
    ... Richard Lewis Haggard wrote: ... one of the forms has a button and an edit window. ... > and the contents of the edit are supposed to be read and put into a CString. ... The edit is obviously alive but its wrapping CEdit ...
    (microsoft.public.vc.mfc)