<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Office 2010 frame caption buttons</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Office 2010 frame caption buttons]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 20 Apr 2026 14:37:32 +0000</pubDate>
  <lastBuildDate>Thu, 15 Mar 2012 10:55:16 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=19550</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Office 2010 frame caption buttons : It seems to work for me with a...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=19550&amp;PID=67807&amp;title=office-2010-frame-caption-buttons#67807</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=7384">TimurA</a><br /><strong>Subject:</strong> 19550<br /><strong>Posted:</strong> 15 March 2012 at 10:55am<br /><br />It seems to work for me with a workaround like this.<br><br>Derive the ribbonbar and override RefreshSysButtons(). <br>Instead of CControlMDIButton, created in the CXTPMenuBar::RefreshSysButtons(), create your own buttons, which are a mix of CControlMDIButton and CXTPRibbonBarControlCaptionButton.<br><br>CControlMDIButton is used by Toolkit to draw mdi buttons in menubar, they aren't overridden in CXTPRibbonBar, therefore we are getting the appearance which is not conform to office 2010.<br><br>CXTPRibbonBarControlCaptionButton is used by Toolkit to draw frame buttons (right images on a false background).<br><br>The Draw() method of my button combines both drawing methods.<br><br>The code may be not optimal and not tested well, but I've got the desired appearance in the MDIRibbonSample.<br><br>@Codejock: is there a better way?<br><br><br><br>CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pCommandBars-&gt;Add(_T("The Ribbon"), xtpBarTop, RUNTIME_CLASS(CHypRibbonBar));<br><br><br>#pragma once<br><br>class CHypRibbonBar : public CXTPRibbonBar<br>{<br>&nbsp;&nbsp;&nbsp; DECLARE_XTP_COMMANDBAR(CHypRibbonBar)<br><br>public:<br>&nbsp;&nbsp;&nbsp; CHypRibbonBar();<br>&nbsp;&nbsp;&nbsp; ~CHypRibbonBar();<br><br>&nbsp;&nbsp;&nbsp; virtual void RefreshSysButtons();<br><br>protected:<br>&nbsp;&nbsp;&nbsp; void AddSysButtonEx(int nId);<br>};<br><br>//______________________________________________________________________________________<br><br>#include "stdafx.h"<br>#include "HypRibbonBar.h"<br><br>//______________________________________________________________________________________<br><br>class CHypControlMDIButton : public CXTPControlButton<br>{<br>public:<br>&nbsp;&nbsp; &nbsp;CHypControlMDIButton(CXTPCommandBarsFrameHook* pFrame)<br>&nbsp;&nbsp; &nbsp;{<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;m_pFrame = pFrame;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;m_dwFlags |= xtpFlagRightAlign | xtpFlagSkipFocus | xtpFlagManualUpdate | xtpFlagNoMovable;<br>&nbsp;&nbsp; &nbsp;}<br>&nbsp;&nbsp; &nbsp;CSize GetSize(CDC* pDC)<br>&nbsp;&nbsp; &nbsp;{<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CSize sz = __super::GetSize(pDC);<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;int nSize = sz.cy;<br><br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//return CSize(16, 16);<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return CSize(nSize, nSize);<br>&nbsp;&nbsp; &nbsp;};<br>&nbsp;&nbsp; &nbsp;void SetBeginGroup(BOOL /*bBeginGroup*/)<br>&nbsp;&nbsp; &nbsp;{<br>&nbsp;&nbsp; &nbsp;}<br>&nbsp;&nbsp; &nbsp;void Draw(CDC* pDC)<br>&nbsp;&nbsp; &nbsp;{<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//GetPaintManager()-&gt;DrawControlMDIButton(pDC, this);<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // background of MDIButton<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GetPaintManager()-&gt;DrawControlEntry(pDC, this);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // icon of CaptionButton, but without background!<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ((CXTPRibbonBar*)GetParent())-&gt;GetPaintManager()-&gt;GetFramePaintManager()-&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DrawFrameCaptionButton(pDC, GetRect(), GetStdId(), FALSE/*GetSelected()*/, FALSE/*GetPressed()*/, m_bEnabled &amp;&amp; m_pFrame-&gt;IsFrameActive());<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; void OnExecute()<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // we'll use some protected members<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; class _MenuBar : public CXTPMenuBar&nbsp; { friend class CHypControlMDIButton; };<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; HWND hWndChild = ((_MenuBar*)(CXTPMenuBar*)m_pParent)-&gt;GetActiveMdiChildWnd();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ASSERT(hWndChild);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; UINT nId = GetStdId();<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ::PostMessage(hWndChild, WM_SYSCOMMAND, nId, 0);<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; UINT GetStdId() const<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; UINT nId = m_nId == XTP_ID_MENUBAR_CLOSE ? SC_CLOSE :<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_nId == XTP_ID_MENUBAR_RESTORE ? SC_RESTORE : SC_MINIMIZE;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return nId;<br>&nbsp;&nbsp;&nbsp; }<br><br>protected:<br>&nbsp;&nbsp;&nbsp; CXTPCommandBarsFrameHook* m_pFrame;<br>};<br><br>//______________________________________________________________________________________<br><br>IMPLEMENT_XTP_COMMANDBAR(CHypRibbonBar, CXTPRibbonBar)<br><br>//______________________________________________________________________________________<br><br>CHypRibbonBar::CHypRibbonBar()<br>{<br>}<br><br>//______________________________________________________________________________________<br><br>CHypRibbonBar::~CHypRibbonBar()<br>{<br>}<br><br>//______________________________________________________________________________________<br><br>void CHypRibbonBar::RefreshSysButtons()<br>{<br>&nbsp;&nbsp;&nbsp; //CXTPMenuBar::RefreshSysButtons();<br><br>&nbsp;&nbsp;&nbsp; BOOL bMax = FALSE;<br>&nbsp;&nbsp;&nbsp; HWND hWndActiveChild = GetActiveMdiChildWnd(&amp;bMax);<br>&nbsp;&nbsp;&nbsp; DWORD dwStyle = hWndActiveChild ? GetWindowLong(hWndActiveChild, GWL_STYLE) : 0;<br><br>&nbsp;&nbsp;&nbsp; CXTPControl* pButton = m_pControls-&gt;FindControl(XTP_ID_MENUBAR_SYSMENU);<br><br>/*&nbsp;&nbsp;&nbsp; if (bMax &amp;&amp; (m_dwFlags &amp; xtpFlagAddMDISysPopup))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; HMENU hDocMenuButton = pButton ? ((CControlMDISysMenuPopup*)pButton)-&gt;m_hDocMenu : 0;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; HMENU hDocMenu =<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ::GetSystemMenu(hWndActiveChild, FALSE);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (hDocMenu &amp;&amp; ::IsMenu(hDocMenu))<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (hDocMenuButton != hDocMenu)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pButton)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ((CControlMDISysMenuPopup*)pButton)-&gt;SetMDISysMenu(hWndActiveChild, hDocMenu);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DelayRedraw();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AddSysButton(new CControlMDISysMenuPopup(hWndActiveChild, hDocMenu), XTP_ID_MENUBAR_SYSMENU, _T(""), 0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pButton) m_pControls-&gt;Remove(pButton);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; else */if (pButton) m_pControls-&gt;Remove(pButton);<br><br>&nbsp;&nbsp;&nbsp; pButton = m_pControls-&gt;FindControl(XTP_ID_MENUBAR_MINIMIZE);<br>&nbsp;&nbsp;&nbsp; if (!pButton &amp;&amp; bMax &amp;&amp; (dwStyle &amp; WS_MINIMIZEBOX) &amp;&amp; (dwStyle &amp; WS_SYSMENU) &amp;&amp; (!(m_dwFlags &amp; xtpFlagHideMinimizeBox))) <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //AddSysButton(new CHypControlMDIButton(), XTP_ID_MENUBAR_MINIMIZE, _T("0"));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AddSysButtonEx(XTP_ID_MENUBAR_MINIMIZE);<br>&nbsp;&nbsp;&nbsp; else if (pButton &amp;&amp; !bMax) <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_pControls-&gt;Remove(pButton);<br><br>&nbsp;&nbsp;&nbsp; pButton = m_pControls-&gt;FindControl(XTP_ID_MENUBAR_RESTORE);<br>&nbsp;&nbsp;&nbsp; if (!pButton &amp;&amp; bMax &amp;&amp; (dwStyle &amp; WS_MAXIMIZEBOX) &amp;&amp; (dwStyle &amp; WS_SYSMENU) &amp;&amp; (!(m_dwFlags &amp; xtpFlagHideMaximizeBox))) <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //AddSysButton(new CHypControlMDIButton(), XTP_ID_MENUBAR_RESTORE, _T("2"));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AddSysButtonEx(XTP_ID_MENUBAR_RESTORE);<br>&nbsp;&nbsp;&nbsp; else if (pButton &amp;&amp; !bMax) <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_pControls-&gt;Remove(pButton);<br><br>&nbsp;&nbsp;&nbsp; pButton = m_pControls-&gt;FindControl(XTP_ID_MENUBAR_CLOSE);<br>&nbsp;&nbsp;&nbsp; if (!pButton &amp;&amp; bMax &amp;&amp; (dwStyle &amp; WS_SYSMENU) &amp;&amp; (!(m_dwFlags &amp; xtpFlagHideClose))) <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //AddSysButton(new CHypControlMDIButton(), XTP_ID_MENUBAR_CLOSE, _T("r"));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AddSysButtonEx(XTP_ID_MENUBAR_CLOSE);<br>&nbsp;&nbsp;&nbsp; else if (pButton &amp;&amp; !bMax) <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_pControls-&gt;Remove(pButton);<br><br><br>&nbsp;&nbsp;&nbsp; if (IsFrameThemeEnabled())<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CString strWindowText;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GetSite()-&gt;GetWindowText(strWindowText);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (strWindowText != m_strCaptionText)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DelayLayout();<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>//______________________________________________________________________________________<br><br>void CHypRibbonBar::AddSysButtonEx(int nId)<br>{<br>&nbsp;&nbsp;&nbsp; CHypControlMDIButton* pButton = new CHypControlMDIButton(GetFrameHook());<br>&nbsp;&nbsp;&nbsp; m_pControls-&gt;Add(pButton, nId);<br><br>&nbsp;&nbsp;&nbsp; UINT nStdId = pButton-&gt;GetStdId(); // XTP_ID_MENUBAR_CLOSE -&gt; SC_CLOSE<br><br>&nbsp;&nbsp;&nbsp; CString strCaption;<br>&nbsp;&nbsp;&nbsp; CMenu* pMenu = GetSite()-&gt;GetSystemMenu(FALSE);<br>&nbsp;&nbsp;&nbsp; if (pMenu)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pMenu-&gt;GetMenuString(nStdId, strCaption, MF_BYCOMMAND);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int nIndex = strCaption.Find(_T('\t'));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (nIndex &gt; 0)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strCaption = strCaption.Left(nIndex);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; if (pButton-&gt;GetAction())<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pButton-&gt;GetAction()-&gt;SetCaption(_T(""));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pButton-&gt;GetAction()-&gt;SetDescription(NULL);<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; pButton-&gt;SetDescription(NULL);<br>&nbsp;&nbsp;&nbsp; pButton-&gt;SetCaption(_T(""));<br>&nbsp;&nbsp;&nbsp; pButton-&gt;SetTooltip(strCaption);<br>}<br><br>//______________________________________________________________________________________ <br>]]>
   </description>
   <pubDate>Thu, 15 Mar 2012 10:55:16 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=19550&amp;PID=67807&amp;title=office-2010-frame-caption-buttons#67807</guid>
  </item> 
  <item>
   <title><![CDATA[Office 2010 frame caption buttons : Hi,same problem in blue and silver...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=19550&amp;PID=67805&amp;title=office-2010-frame-caption-buttons#67805</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=7384">TimurA</a><br /><strong>Subject:</strong> 19550<br /><strong>Posted:</strong> 15 March 2012 at 6:51am<br /><br />Hi,<br><br>same problem in blue and silver office 2010 themes.<br>In the black theme, the buttons are seen better, but their appearance is not exactly like in MSOffice 2010.<br><br>Is there a solution?<br><br>Regards,<br>Timur<br><br>       <div ="msgSignature">     Windows 7, VS 2005, Toolkit Pro 15.0.1 and 15.2.1    </div><br>]]>
   </description>
   <pubDate>Thu, 15 Mar 2012 06:51:35 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=19550&amp;PID=67805&amp;title=office-2010-frame-caption-buttons#67805</guid>
  </item> 
  <item>
   <title><![CDATA[Office 2010 frame caption buttons : Hi,How do I get the frame caption...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=19550&amp;PID=67745&amp;title=office-2010-frame-caption-buttons#67745</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1263">Fredrik</a><br /><strong>Subject:</strong> 19550<br /><strong>Posted:</strong> 06 March 2012 at 11:44am<br /><br />Hi,&nbsp;<div><br></div><div>How do I get the frame caption buttons look like Office 2010 when the MDI child window is maximized?</div><div><img src="uploads/1263/RestoreButt&#111;n.png" height="215" width="198" border="0" /><br></div><div><br></div><div>Thanks,&nbsp;</div><div>Fredrik</div>]]>
   </description>
   <pubDate>Tue, 06 Mar 2012 11:44:32 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=19550&amp;PID=67745&amp;title=office-2010-frame-caption-buttons#67745</guid>
  </item> 
 </channel>
</rss>