Re: trouble posting message from a ccombo
From: AliR (AliR_at_newsgroup.nospam)
Date: 02/25/05
- Next message: AliR: "Re: mfc size"
- Previous message: Eric: "Re: COM threaded problem - newbie"
- Next in thread: Scott McPhillips [MVP]: "Re: trouble posting message from a ccombo"
- Maybe reply: Scott McPhillips [MVP]: "Re: trouble posting message from a ccombo"
- Maybe reply: AliR: "Re: trouble posting message from a ccombo"
- Messages sorted by: [ date ] [ thread ]
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.
>
>
>
- Next message: AliR: "Re: mfc size"
- Previous message: Eric: "Re: COM threaded problem - newbie"
- Next in thread: Scott McPhillips [MVP]: "Re: trouble posting message from a ccombo"
- Maybe reply: Scott McPhillips [MVP]: "Re: trouble posting message from a ccombo"
- Maybe reply: AliR: "Re: trouble posting message from a ccombo"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|