Page 1 of 1
Custom Controls and their dialogs.
Posted: Sat Oct 02, 2004 5:19 pm
by fliptw
I have a custom control, lets call him Jack, that is part of a dialog called Jill.
how would Jack go about sending messages to Jill?
Posted: Sat Oct 02, 2004 5:47 pm
by MehYam
I'm not an expert at custom controls, but I imagine you have a few options available to you. What does your control do? If it's a custom button, for instance, then it kinda makes sense to just subclass the button proc and pretend you're really just like a button. The WM_PARENTNOTIFY mechanism also comes to mind.
I guess another thing to consider is that the Treeview and Listview controls are really just custom controls that come from Microsoft. Check out their command/event API in the MSDN for some ideas.
Is this C++, VB, or .NET?
Posted: Sat Oct 02, 2004 6:07 pm
by DCrazy
Important question: are you using MFC or plain old WinAPI?
Using WinAPI:
Get the HWND of Jack's parent using hWndJill = (HWND)(
GetWindowLong(hWndJack, GWL_HWNDPARENT)); and use either
PostMessage to post the message in Jill's queue and keep on moving, or
SendMessage to wait until Jill is done processing Jack's message.
MehYam, WM_PARENTNOTIFY is sent by Windows to a parent window for create, destroy, and mouse-related events.
Posted: Sat Oct 02, 2004 7:33 pm
by fliptw
Thats what I was looking for. thanks Dcrazy.
Posted: Mon Oct 04, 2004 8:36 am
by MehYam
DCrazy wrote:MehYam, WM_PARENTNOTIFY is sent by Windows to a parent window for create, destroy, and mouse-related events.
Which may be all he needs. Dunno.
BTW, there's a GetParent() you could use instead of querying the window's bytes... might be safer.