CompuServe Thread

#CToolbar and CMDIChild

3 messages in this thread
#30229From: Matthew FermJul 8, 1994 2:06 AM
I am writing code to allow me to save am MDI child window position and restore it next time a document is opened (it is saved in the document). I now have this working except for the fact that I need to "factor-out" the vertical size of the toolbar. It seems that SetWindowPos() will place an MDI window at the coordinates you specify relative to any classes generated by the CControlBar class (CToolbar, CStatusBar, etc.) GetWindowRect() in conjuction with ScreenToClient() will get the Window coordinates relative to the top of the MDI client window. What I want to do is "normalize" the window position so that when I use GetWindowRect() and the toolbar is displayed, I will always subtract the size of the toolbar. This "normalization" would be very similar to the way Visual Basic treats the "threed.vbx" widget in an MDI window. In VB, all window coordinates are normalized so that the start of the window is at the bottom of the toolbar (frame) object. From within my view (or document, app, frame, etc.), how can I figure out the number and size of the toolbars I have at the top of my window? Thanks, Matt Ferm
#30282From: Steve McAdamsJul 8, 1994 10:24 AM
>> From within my view (or document, app, frame, etc.), how can I figure out the number and size of the toolbars I have at the top of my window? << Aside from writing them down when you create them? I think the best you can do is traverse the frame's list of child-windows and check using CObject::IsKindOf or one of its friends to see if you found a CControlBar derivative. This won't necessarily work for all toolbars, just those derived from CControlBar (obvious, I guess). -steve
#30363From: Matthew FermJul 9, 1994 7:07 AM
Thanks. I was hoping that there might have been a short-cut. Matt