Custom Controls and their dialogs.

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Custom Controls and their dialogs.

Post 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?
User avatar
MehYam
DBB Head Flapper
DBB Head Flapper
Posts: 2184
Joined: Thu Nov 05, 1998 12:01 pm
Location: Mountain View, CA, USA
Contact:

Post 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?
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post 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.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

Thats what I was looking for. thanks Dcrazy.
User avatar
MehYam
DBB Head Flapper
DBB Head Flapper
Posts: 2184
Joined: Thu Nov 05, 1998 12:01 pm
Location: Mountain View, CA, USA
Contact:

Post 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.
Post Reply