Ugly Yellow Tooltips in your MFC Application Using the Windows 7 Theme

Posted by Matt | Filed under , , , ,

I found another bug in MFC in Visual Studio 2010, but it’s an easy one to fix.

If you create a new MFC Ribbon project and use the Windows 7 colour scheme, then you’ll notice that the tooltips are ugly and yellow.

image

If you want to get the attractive tooltips back, you need to add a little bit of code.  Pat Brenner gave a solution when I reported the problem on the MSDN Forums.  This solution will work if you are allowing theme switching in your application.  If you are not, then you need to add similar code, elsewhere.  If this is the case for you, add the following code to CMainFrame::OnCreate():

CMFCToolTipInfo ttParams;
ttParams.m_bVislManagerTheme = FALSE;
ttParams.m_bDrawSeparator = FALSE;
ttParams.m_clrFillGradient = afxGlobalData.clrBarFace;
ttParams.m_clrFill = RGB(255, 255, 255);
ttParams.m_clrBorder = afxGlobalData.clrBarShadow;
ttParams.m_clrText = afxGlobalData.clrBarText;
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
  RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);

If you do this, you’ll get the attractive tooltips you’re looking for.

image

Correcting a Windows 7 Ribbon project using Visual Studio 2010

Posted by Matt | Filed under , , ,

So you’ve created a new MFC Ribbon application that has the Windows 7 ribbon look to it.  Unfortunately, when you run the application, it looks like this:

Screen_Bad

Notice the big ugly button in the corner, and the quick access toolbar is not drawn correctly (down arrow menu button).

This happens when you do not select the “Enable visual style switching” option.

image

The correction is to find this line of code in MainFrm.cpp:

CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(
	CMFCVisualManagerWindows7));

and add the following line immediately after it:

m_wndRibbonBar.SetWindows7Look(TRUE);

Once you’ve done that, your window will look correct.

Screen_Good

I’ve reported the issue on Microsoft Connect.  A link to the report can be found here.

Compatible with Windows 7 Application Testing

Posted by Matt | Filed under , ,

Compatible with Windows 7 Back with Vista, Microsoft had 2 logo designations:  Works with Vista and Certified for Vista.  The former was a free self-test, the latter was an expensive 3rd party test.  For Windows 7, Microsoft has consolidated the two designations into a single logo:  Compatible with Windows 7.  This is done as a self-test using the latest toolkit.

However, not all companies have the time and/or resources to do the testing themselves.  Sometimes it’s more economical to farm the manual work off to another party to do the testing.  Let’s face it, would you rather spend your time adding new features and improvements, or would you rather be spending time testing your application for Windows 7 compatibility?

To meet this need, I’ve started LogoPlus.  LogoPlus is a service where businesses can farm out the manual labour of testing their applications against the toolkit.  They should still make sure they meet the logo requirements.  However, the work of setting up the Windows 7 Ultimate x64 operating systems, testing and re-testing, etc. can be done by LogoPlus.

If you’re in charge of getting your product Compatible with Windows 7 tested, I encourage your to check out the service.  I think you’ll find the the prices are competitive and economical.

Windows 7 Release Candidate Released

Posted by Matt | Filed under ,

Microsoft released Windows 7 Release Candidate 1 to MSDN and TechNet subscribers yesterday.  This should have most of the new functionality we’ve been waiting for (including the new task bar and jump menus).  If you’re an MSDN subscriber, you can download it here.  If you’re not, you’ll need to wait until May 5 at which point, it will be available at the Microsoft Downloads site.

More information can be found at Channel 9.

Related, Windows 7 logo certification is now in it’s Alpha stage.  If you’re looking to get your application certified for Windows 7, take a look at the logo program requirements.  They look very similar to Vista’s.  Later this year, Microsoft will be releasing their logo toolkit which can be used to pre-test your applications.  More information can be found at Microsoft’s main Windows 7 Logo Program website.