Switching between CMFCRibbonBar based Ribbon interface and CMFCMenuBar/CMFCToolBar based interface on-the-fly

Download sample project – MFCRibbonToolBarDemo Since the advent of MFC Feature Pack, Ribbon bar based interfaces have been extremely popular as well as useful. However, there might be some scenarios/use-cases when one would want to have both the interfaces i.e. the traditional Menu/Toolbar based interface as well as the modern Ribbon bar based interface in…

3

MFC app main window activation/deactivation painting issue

To reproduce this issue please follow these steps… Enable a non-Aero theme like Windows 7 Basic theme Create a new MFC application. Please make sure you’ve selected “Windows 7” for visual style and colors. Also you might notice that the issue is only reproducible when the application runs for the first time on a machine….

4

AfxBeginThread fails to create thread on Windows XP

How can AfxBeginThread fail when there are plenty of resources available and the application is a multi threaded one. That’s what I thought when I saw this issue from a customer. I went and read the documentation for AfxBeginThread and I didn’t see anything unusual that customer is doing. He also mentioned that CreateThread fails…

0

Adding a Configuration file for a VC++ DLL

Background   A VC++ application will fail to run if the required Visual C++ runtime libraries are not present on the target operating system (machine).  It’s the manifest of the executable used by the operating system loader to load assemblies that your application depends on.  Any C/C++ program built by Visual C++ 2005/2008 has to include…

1

MFC Feature pack and desktop composition issue

MFC Feature pack application makes it possible to mimic the look and feel of office and outlook, however, when it comes to customization, well, one has to make a few changes to the application to get the desired result.     Problem   I came across a scenario where an MFC feature application carrying office…


Removing the Frame Caption when Using CMFCVisualManagerOffice2007

When BCGSoft created the classes that Microsoft incorporated as the “MFC Feature Pack” in VS 2008 (and included in SP1), it seems their primary intent was to provide a nearly hands-free implementation of several popularly-requested user interface features.  Especially with the “Visual Manager” classes (derived from CMFCVisualManager), it’s clear that the intent was to easily…

5

Troubleshooting MFC state related issues

In this article we will be talking about MFC Module state and Thread state , and how do we troubleshoot issues related to Module state mismatch. Why MFC dll does needs a module-specific state? Well reason is MFC is a shared dll, it needs to be shared between various modules (dlls\exe) that are linked with…

4

How to handle chevron button using CToolBarCtrl object?

Most of the developers work with CToolBarCtrl but they get stuck when it comes to display chevron button. This article is all about how to get chevron button displayed on CToolBarCtrl control while resizing its content window.   There is a good MSDN article on handling chevrons but no good sample implementation on it. I wrote a small…


Why AfxGetThread() returns NULL in AfxWinMain()?

Recently I worked with one of my colleague on an interesting scenario in which the MFC application was crashing on startup. The next step was to run the application under WinDbg. After running the application under WinDbg we saw that we are actually access violating an address which was indeed a NULL pointer. The access…

2