The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: NoCforMe on November 22, 2011, 01:52:28 AM

Title: Help organizing & placing windows
Post by: NoCforMe on November 22, 2011, 01:52:28 AM
i'm working on an app with a toolbar across the top. I'd like to add a strip above the toolbar where I can put some more controls (a couple combo boxes, maybe some more buttons). I can't quite figure out how to do this.

Shoiuld ITo see if the second method would work, I tried moving the toolbar window down by using MoveWindow(), but no matter what value I passed it for Y, the window remained stuck where it was, at the top of the parent's client area. So it seems this is the way toolbars were designed to work, at least by default. I looked for some styles that might allow me to move it, but didn't find anything.

I don't want a floating toolbar (i.e, one that can be picked up and moved by the user), just to move it down and put some other stuff above it. If this doesn't work, I guess I could put my other controls below the toolbar, but I'd really rather have them above.

I have lots of programs that do just this, so I know it's possible, just don't know how. Hopefully this can be done without subclassing, using plain vanilla Windows stuff.
Title: Re: Help organizing & placing windows
Post by: mineiro on November 22, 2011, 02:54:09 AM
I think you are looking for "rebar" Sr NoCforMe.
Title: Re: Help organizing & placing windows
Post by: NoCforMe on November 22, 2011, 03:06:21 AM
Hmm; I've been seeing that term a lot on MSDN but hadn't bothered trying to find out what it was. Now I know.

Not sure that's what I want. Apparently you can only put one child window (e.g., a combobox control) in each band, so I'd have to create multiple bands. I was hoping for something a little simpler. But I've got rebars bookmarked ...
Title: Re: Help organizing & placing windows
Post by: jj2007 on November 22, 2011, 06:24:09 AM
Here is a list of candidates (http://msdn.microsoft.com/en-us/library/windows/desktop/ff486063%28v=vs.85%29.aspx), and TB_SETBOUNDINGSIZE is one of them. You may need subclassing, though.
Title: Re: Help organizing & placing windows
Post by: NoCforMe on November 22, 2011, 07:02:03 AM
Well, after digging around in MSDN a while, I found another way to do this (http://msdn.microsoft.com/en-us/library/hh298391%28v=VS.85%29.aspx). (Look, Ma, no subclassing!)
Title: Re: Help organizing & placing windows
Post by: ToutEnMasm on November 22, 2011, 09:40:08 AM
Quote
Well, after digging around in MSDN a while, I found another way to do this. (Look, Ma, no subclassing!)
An interesting soluce to create the same thing as a rebar without his many advantages .
With a rebar,you can move and resize the bands with the mouse.This need no line code to work.
Quote
you can only put one child window (e.g., a combobox control) in each band
This need to be verify.
Title: Re: Help organizing & placing windows
Post by: ToutEnMasm on November 22, 2011, 10:26:10 AM

I have verify that a band could have only one child window (only one combo),it's false.
Here is a simple sample.
Title: Re: Help organizing & placing windows
Post by: NoCforMe on November 22, 2011, 06:08:40 PM
Quote from: ToutEnMasm on November 22, 2011, 09:40:08 AM
Quote
Well, after digging around in MSDN a while, I found another way to do this. (Look, Ma, no subclassing!)
An interesting soluce to create the same thing as a rebar without his many advantages .
With a rebar,you can move and resize the bands with the mouse.This need no line code to work.

But I don't want those "advantages". I don't want the band to be resizeable, or moveable, or configurable. I just want a place to park some additional controls.
Title: Re: Help organizing & placing windows
Post by: NoCforMe on November 22, 2011, 06:23:39 PM
So to get back to my original question (remember that?), is there any way I can open up some (parent client area) space above a toolbar and put controls in that space?

Or do toolbars have "magnets" that keep them firmly fixed to the top of their parent windows? (This appears to be the case, as I've tried to use MoveWindow() to move the toolbar down, but it didn't work.) This would still be my first choice in my situation.
Title: Re: Help organizing & placing windows
Post by: mineiro on November 22, 2011, 09:20:37 PM
I have tried it, and movewindow do not have worked like you say. Now I understand.
So, I played with it, thinking that toolbar is fixed on the upper, but if you set some styles, you can put the toolbar to down.
TBSTYLE_ALTDRAG OR TBSTYLE_FLAT OR TBSTYLE_TRANSPARENT OR CCS_BOTTOM OR CCS_NOMOVEY OR CCS_TOP OR WS_CHILD OR WS_OVERLAPPED OR WS_VISIBLE

In microsoft site have one tool to play with messages and styles of controls, I use that tool before code. (Control Spy 2.0). I'm now investigating the messages received to toolbar control to see if I can give you one answer.
Title: Re: Help organizing & placing windows
Post by: jj2007 on November 22, 2011, 10:16:06 PM
CCS_NOMOVEY does the trick, see attachment - thanks mineiro :U
Title: Re: Help organizing & placing windows
Post by: mineiro on November 22, 2011, 10:24:24 PM
You can use CCS_NOMOVEY with CCS_NORESIZE, so movewindow will work. :U
Title: Re: Help organizing & placing windows
Post by: NoCforMe on November 23, 2011, 01:26:17 AM
I'm confused. (A not uncommon state of affairs.)

MSDN says (http://msdn.microsoft.com/en-us/library/windows/desktop/bb775498%28v=vs.85%29.aspx) about CCS_NOMOVEY: "Causes the control to resize and move itself horizontally, but not vertically, in response to a WM_SIZE message.".

Wouldn't I want to use CCS_NOMOVEX instead, since I want to be able to move the toolbar vertically but not horizontally?

jj, I downloaded your example, but cdt.exe doesn't open a window or even show up on the taskbar. ????? Kinda creepy to have a process running that's a ghost ...
Title: Re: Help organizing & placing windows
Post by: mineiro on November 23, 2011, 03:00:13 AM
Hello Sr NoCforMe, I have downloaded jj2007 example and worked here, and appears in taskbar. Depending of style of window, they do not appear in taskbar, follows one that do not appear.
My mistake (sorry) before when I have said that "CCS_NOMOVEY with CCS_NORESIZE" can be combined, because one cancels other.
I have done one example that do not deal with CCS_NOMOVEY, only CCS_NORESIZE and worked.
I think this happens depending of what messages you are treating.


Title: Re: Help organizing & placing windows
Post by: jj2007 on November 23, 2011, 06:28:57 AM
Quote from: NoCforMe on November 23, 2011, 01:26:17 AM
jj, I downloaded your example, but cdt.exe doesn't open a window or even show up on the taskbar. ????? Kinda creepy to have a process running that's a ghost ...

Which OS? You can use Process Manager 8right-click on Windows taskbar) to kill the process.
Title: Re: Help organizing & placing windows
Post by: NoCforMe on November 23, 2011, 06:35:26 AM
Thank you, I know how to kill a process (Win2K here, so I use Task Manager). Why doesn't the app show itself? Just curious.
Title: Re: Help organizing & placing windows
Post by: jj2007 on November 23, 2011, 07:55:32 AM
Quote from: NoCforMe on November 23, 2011, 06:35:26 AM
Thank you, I know how to kill a process (Win2K here, so I use Task Manager). Why doesn't the app show itself? Just curious.
Sorry, I saw you were scared of ghosts so I thought it's better to give details :bg

Quote from: NoCforMe on November 23, 2011, 01:26:17 AM
Kinda creepy to have a process running that's a ghost ...

Re the why: I stole the app from Xandaz (http://www.masm32.com/board/index.php?topic=16732.msg139274#msg139274), and he uses a Windows XP manifest. Try commenting out the manifest in rsrc.rc:
//IDR_XPMANIFEST1 MANIFEST "xpmanifest.xml"
Title: Re: Help organizing & placing windows
Post by: ToutEnMasm on November 23, 2011, 08:07:16 AM
Quote
But I don't want those "advantages". I don't want the band to be resizeable, or moveable, or configurable. I just want a place to park some additional controls.
see http://msdn.microsoft.com/en-us/library/windows/desktop/bb774393(v=vs.85).aspx
Quote
RBBS_FIXEDSIZE The band can't be sized. With this style, the sizing grip is not displayed on the band
Title: Re: Help organizing & placing windows
Post by: NoCforMe on November 23, 2011, 07:10:57 PM
Quote from: ToutEnMasm on November 23, 2011, 08:07:16 AM
see http://msdn.microsoft.com/en-us/library/windows/desktop/bb774393(v=vs.85).aspx
Quote
RBBS_FIXEDSIZE The band can't be sized. With this style, the sizing grip is not displayed on the band

Thanks. I've got that bookmarked and will experiment with it.
Title: Re: Help organizing & placing windows
Post by: jj2007 on November 23, 2011, 07:43:20 PM
Quote from: jj2007 on November 23, 2011, 07:55:32 AM
Try commenting out the manifest in rsrc.rc:
//IDR_XPMANIFEST1 MANIFEST "xpmanifest.xml"

Did you try?
Title: Re: Help organizing & placing windows
Post by: NoCforMe on November 24, 2011, 12:30:21 AM
Well, I remade the program but it made no difference. Commented out that manifest line like you told me to, assembled & linked, still no visible window nor appearance in the taskbar.

That's the limit of my patience and my curiosity concerning this. Life's too damn short ...
Title: Re: Help organizing & placing windows
Post by: jj2007 on November 24, 2011, 06:26:38 AM
Quote from: NoCforMe on November 24, 2011, 12:30:21 AM
Well, I remade the program but it made no difference. Commented out that manifest line like you told me to, assembled & linked, still no visible window nor appearance in the taskbar.

That's the limit of my patience and my curiosity concerning this. Life's too damn short ...

You are using Win2K, that's a bit ancient. With a debugger, one could find out where it fails...