Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Substitute Tite bar for window

Substitute Tite bar for window

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TrungHuynh
    wrote on last edited by
    #1

    Hello I created a substitue title bar to replace the original title bar (gradient fill...) of Dialog or CMDIFrameWnd or CMDIChildWnd.First i remove the original titlebar of windows. Then i created a substitue window with style : WS_VISIBLE | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN and i put this window as the same place as original title bar: RECT rcWnd; ::GetWindowRect(m_pParentWnd->m_hWnd, &rcWnd); // The m_pParentWnd is the CWnd of Dialog or // frame that i pass to this class. TITLEBARINFO tbi; tbi.cbSize = sizeof(TITLEBARINFO); ::GetTitleBarInfo(m_pParentWnd->m_hWnd, &tbi); RECT rcTitlebar = tbi.rcTitleBar; //Calculate the rect we need to create substitute // window for titlebar RECT rcSubstitute = {rcWnd.left, rcWnd.top, rcWnd.right, rcTitlebar.bottom}; //pszTitle is text on title bar //The CBMSTITLEBARDIALOG_CLASSNAME is already register before create window DWORD dwStyle = WS_VISIBLE | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; BOOL bResult = CreateEx(WS_EX_TOOLWINDOW, CBMSTITLEBARDIALOG_CLASSNAME, pszWindowName, dwStyle, rcSubstitute.left, rcSubstitute.top, rcSubstitute.right - rcSubstitute.left, rcSubstitute.bottom - rcSubstitute.top, m_pParentWnd->m_hWnd, NULL, NULL ); If the parent window is CMDIFrameWnd or CMDIChildWnd, it's ok the substistute title bar is put the same place with the original titlebar and have these effects that i want. But with dialog the substistue title bar was wrong. (Not the same place with original title bar). ??? I think because the Dialog has WS_POPUP style, and the Substitue title bar that i create has the same WS_POPUP style. So it's wrong, is it right ? or some another reason. Please help me. Thanks

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups