hey

does anyone know how i can have a child window within a child window but
still have it sub-classed with the main window proc.

so basically i have the main window (hWin) and i've got a static window (hStatic1) in
that main window and i've then got more windows inside that static window (hStatic1)
this way i can hide the hStatic1 and it will hide all of it's child windows.

the problem is that i want all the controls to have the main window proc (from hWin)
but still have some controls as child windows of hStatic1.

can anyone help ?
Posted on 2004-08-06 09:20:44 by someone
Create the child windows as children of the parent (main) window then use SetParent to change it to the static. SetParent will change the parent for hiding the children etc... but will not alter where it sends it's messages so even though they act like children of the static they still send notifications to the main window.
Posted on 2004-08-06 09:39:05 by donkey
hey
nope didn't work, it just did the same thing
Posted on 2004-08-06 10:10:55 by someone
You can have 1000 windows all with the same winproc if you want, you just need to make sure that you test the value of hwnd before you do anything so that you know the context in which wndproc was called.
Posted on 2004-08-06 12:01:54 by iblis
I'm curious about the subclass part.

If you subclass, you no longer are using the original window procedure, except as a default for messages your window is not handling.

If you are augmenting predefined controls by subclassing, then to use the same overriding procedure for your main window probably means you need to subclass your main window (for consistent handling).
Posted on 2004-08-06 22:09:32 by tenkey
iblis, thats not exactly the problem but thanks anyway

tenkey, not sure exactly what you mean, but the window inside the child window isn't subclassed, when i create the window, the parent window part of the CreateWindowEx function is the static (which is a child window of the main window)

if i try subclassing the window inside the child window, it just disappears altogether
Posted on 2004-08-06 22:58:09 by someone
anyone else got any other ideas ?
Posted on 2004-08-08 02:31:57 by someone
Hi someone,

First off a static is a very bad idea for this type of thing, it is limited in it's def window proc as to what it can do and what it ignores. You should think about creating a dialog for this. You have only to create a dialog with the style WS_CHILD+WS_VISIBLE+DS_CONTROL and place your buttons etc... on that. You have to use a Dialog as Window or a window app and then set the DlgProc for the children to point to the main window.

Here's an example...
Posted on 2004-08-08 03:31:23 by donkey
hey donkey
thanks for the example, but it didn't help to much, cause i'm not using dialog windows, i'm using CreateWindowEx, but thanks anyway.
also i'm using a static cause it's ownerdrawn and that was the easiest way without subclassing it, i changed it to a proper window but it didn't make much difference
Posted on 2004-08-08 04:00:58 by someone
It really makes no difference how you decide to create the window, I used dialogs because I didn't want to waste a whole lot of time. If I use a dialog as a main window it then becomes the exact same as any windw created through CreateWindowEx. Just replace the CreateDialogParam call with your CreateWindowEx call.
Posted on 2004-08-08 04:04:23 by donkey
its a bit different for me though, because most of the controls are owner-drawn so i have to sub class some and not others
also the CreateWindowEx function has styles and all that stuff that needs to be correct
anyway i can create the window inside the window but it doesn't process any messages
Posted on 2004-08-08 06:41:31 by someone