DOCUMENT:Q151162 30-JUL-2001 [visualc] TITLE :PRB: CToolBarCtrl Styles Fail with CToolBar PRODUCT :Microsoft C Compiler PROD/VER:winnt:4.0,4.1 OPER/SYS: KEYWORDS:kbCmnCtrls kbMFC kbToolbar KbUIDesign kbVC400 kbVC410 kbGrpDSMFCATL kbMFCCtrlBar ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - The Microsoft Foundation Classes (MFC), used with: - Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.1 ------------------------------------------------------------------------------- SYMPTOMS ======== CToolBarCtrl styles such as CCS_ADJUSTABLE are ignored by CToolBar::Create(), and do not have any affect on the CToolBar that is created. The Common Control Toolbar controls styles that are ignored include CCS_ADJUSTABLE, CCS_BOTTOM, CCS_NOHILITE, CCS_TOP, and the Toolbar styles TBSTYLE_ALTDRAG, TBSTYLE_TOOLTIPS and TBSTYLE_WRAPABLE. CAUSE ===== CToolBar is an implementation of the Common Control Toolbar and requires specific flags. Before calling CWnd::Create() to create the Toolbar control, CToolBar removes all styles in the range of 0 to 0xFFFF. This includes all of the CControlBar (CBRS_X) styles as well as the Common Control styles. The following Common Control styles are then set: CCS_NOPARENTALIGN, CCS_NOMOVEY, CCS_NODIVIDER, and CCS_NORESIZE RESOLUTION ========== One solution is to use ModifyStyle in the handler for WM_NCCREATE to set the styles needed. CToolBarCtrl may also be used instead of CToolBar when modifying the toolbar using the Common Control styles, but the CToolBarCtrl does not support all of the functionality of CToolBar, such as docking, automatic CFrameWnd layout and CmdUI updates. The CToolBarCtrl notifications arising due to these styles also have to be handled. It is possible to set the Common Control styles in CToolBar by deriving a class from CToolBar and overriding the virtual function CToolBar::PreCreateWindow(). This may cause problems because some of the CCS_X styles have the same value as some of the CBRS_X styles. For example, CBRS_FLYBY and CCS_ADJUSTABLE are both 0x0020L. Additional query words: 4.00 4.10 ====================================================================== Keywords : kbCmnCtrls kbMFC kbToolbar KbUIDesign kbVC400 kbVC410 kbGrpDSMFCATL kbMFCCtrlBar Technology : kbAudDeveloper kbMFC Version : winnt:4.0,4.1 Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.