Here's my question:
There's been a number of occasions where I want to write
my own tool bar or menu (for example, a menu with a white
background). But I can't find a way for a child window to
behave like a toolbar would. i.e., sticking to the top or bottom
and *changing* the client area.

Now, I *can* make a window that sits up on top of the
parent window but I still gotta fix up the client area if I want
to use draw in the parent window. But this still really isn't the
behavior I want. I know I can subclass these things but I'd
rather like to know how it's done in the first place?

Can anyone tell me what's going on? How can I program
something like a menu class?


Posted on 2002-04-07 20:03:07 by chorus
maybe you could use an ownerdrawn menu instead of making your own one...
Posted on 2002-04-08 04:34:39 by Vom-bonjour:-()
Yeah... I know... :(
That's not what interests me though. I'm more interested in what
mechanism in win32 allows child windows (like a toolbar or
statusbar) to behave the way they do. Just specifying WS_CHILD
when creating a window obviously doesn't do it. And yet,
the class that toolbars are derived from TOOLBARCLASSNAME is
defined in the common controls DLL so there *must* be
something in there that we're missing...


I guess for now I'll stick with your suggestion :)


Posted on 2002-04-08 11:48:30 by chorus
perhaps WM_NCCALCSIZE ? Dunno really, I remember bumping into
that message while trying to do somewhat the same, but ended
up deciding child window stuff was a lot easier for my purpose.
Posted on 2002-04-08 12:17:04 by f0dder
Menus are part of the non-clent area, and I think Windows does its own special processing of menus and such before it calls your Window.
Posted on 2002-04-08 13:29:46 by iblis

I guess what I really want to know then is: Can I make a child window that sits in the nonclient area? Is there a WS_ or WS_EX_ style that lets me do this?

One thing I would really like to make is a toolbar that sits along the left side of the application window, or a toolbar along the top of my window that I can use to scroll a message or something like that. Things that I can't do by using toolbars or menus as they are defined with Windows.

thanks for the tip about WM_NCCALCSIZE. I looked into it, and it sounds promising at first but then the more I read about it the less it seems to fit the problem. I'll try to test it out with some actual code to see what kind of results I get.

Thanks all

Posted on 2002-04-09 00:10:20 by chorus
I dont have a definitive answer, but I would say you need to simply "write" the code yourself for such specific stuff.

As well i seem to remember Ernie outlined an example on his website for a kitchen timer. It was a custom window that was 'eningeered' to have a client and non-client area. And thus effectively built his own close buttons etc. You should be able to follow this approach and build a scrolling menu etc..

Long story short, i would say what you want can be done, but the would require you to get your hands dirty.

Best of luck...
Posted on 2002-04-09 01:55:41 by NaN
I posted some code i'd written for office xp style menus to the source forum a while ago, but it's not there anymore. i can email it to you or post it again if you'd like.
Posted on 2002-04-09 11:43:14 by Sloat
That would be great!
You can email me through my profile or just post it up, whatever's easier for you. Maybe post it if you want other people to check it out.


Posted on 2002-04-09 11:48:10 by chorus
There is no set windows style for what your trying to do. They are hooking the messages before you see them to give them a default behaviour much like superclassing. The best way to do it is to reserve some space in the non-client area of the window like suggested using the WM_NCCALCSIZE message.
Posted on 2002-04-09 13:17:19 by Graebel
here you go. it's not very clean or optimized cause i stopped working on it a few months ago.
Posted on 2002-04-09 22:51:33 by Sloat
Your zip doesnt seem to have much in it :confused:

Posted on 2002-04-09 23:53:42 by NaN
Sloat... when I try to open the zip I just get a invalid file message from winzip... I thought that I dropped some bytes but I've tried to download it about 5 more times and I get nada...

Posted on 2002-04-09 23:56:12 by chorus
Here's Sloat's file he uploaded Feb 13, 2002
Posted on 2002-04-10 07:46:18 by gscundiff
figures :rolleyes:

i guess the upload got messed up somehow (maybe cause i am using opera).
Posted on 2002-04-10 13:33:17 by Sloat
Pretty cool Sloat :)

I missed it the first time around, but i have to say it looks good..

Im working on something simular ~ 80% finish a custom control for menu'd buttons like the one in IE 5 :) . Just got to get the bumps out at this point...

Posted on 2002-04-10 17:19:41 by NaN