Re: trouble posting message from a ccombo

From: AliR (AliR_at_newsgroup.nospam)
Date: 02/25/05


Date: Fri, 25 Feb 2005 20:38:28 GMT

CBN_SELCHANGE is a notification message that is sent throught WM_COMMAND. I
know the documentation is not very good, but read the documentation on
CBN_SELCHANGE a bit more carefully. I think that MFC's message mapping has
made people lazy.

On a serious note reading a Win32 book cover to cover would help any MFC
programmer understand what is going on under the hood a bit more.

So here is what you have to do

GetParent()->PostMessage(WM_COMMAND,MAKEWPARAM(GetDlgCtrlID(),CBN_SELCHANGE)
,m_hWnd);

I will let Joseph Newcomer rag on you for using PostMessage instead of
SendMessage. ;)

AliR.

"brett" <brett_w2931@hotmail.com> wrote in message
news:TJ-dnaFUa-jzF4LfRVn-vg@adelphia.com...
> Hi,
>
> I'm implementing a custom combo box thats doing some autocomplete stuff
from
> a database. When I'm handling the CBN_EDITCHANGE message, I find that the
> text matches exactly and i want to inform the parent about this. I
> accomplish this by sending a message as if a new item was selected:
>
> GetParent()->PostMessage(CBN_SELCHANGE, WPARAM(GetDlgCtrlID()),
> LPARAM(m_hWnd));
>
> I've also tried calling this from the combo class:
> PostMessage(CBN_SELCHANGE, WPARAM(GetDlgCtrlID()), LPARAM(m_hWnd));
>
> since i'm using ON_CONTROL_REFLECT_EX message handlers to make sure that
the
> parent dialog is going to get the messages.
>
> Unfortunately, both the PostMessages are returning 0. If I call DWORD d =
> ::GetLastError(); I find an error: ERROR_INVALID_ADDRESS
>
> What have I done wrong?
>
> Thanks,
> Brett.
>
>
>



Relevant Pages

  • Re: [why oom_adj does not work] Re: Linux killed Kenny, bastard!
    ... It is not even documented for those who do not read kernel ... However, patches to improve the documentation of the oom killer, or any ... Children are already preferred over the chosen parent task, ...
    (Linux-Kernel)
  • Re: Nested Wimp - was Dragging and Wimp_OpenWindow
    ... questions that the documentation doesn't seem to answer. ... You need a Template editor, which is usually WinEd, TemplEd or FormEd. ... Can I attach it to the right-hand side of the window OUTSIDE ... parent is shrunk horizontally - will the child window be left dangling ...
    (comp.sys.acorn.programmer)
  • [PATCH] Fix line-wrapping in documentation of vmalloc_32_user()
    ... Fix line-wrapping in documentation of vmalloc_32_user. ... commit dc676c9c7abfac7ed26d48777e4be99e110508f3 ... tree 00cbe652d0ed16b324192e74f8f8765b81940bf0 ... parent 8352448458ede55c18c98b39823f71ea8e306c70 ...
    (Linux-Kernel)
  • Re: SetWindowPos()
    ... A non-WS_CHILD window, such as a dialog, is positioned using screen ... The documentation should really be fixed. ... If you would prefer to center it over the client area of the parent ... single monitor, in case the parent has been resized to straddle ...
    (microsoft.public.win32.programmer.ui)
  • Re: VB.Net 2005
    ... >> I just throught in which situations binary number literals would make ... documentation to use an appropriate term;-). ... Herfried K. Wagner [MVP] ...
    (microsoft.public.dotnet.languages.vb)

Loading