I modify some MFC user interface related code, build, run and … nothing changes!

“Well, let’s manually delete the Debug directories and all generated files, then rebuild.”

I can still see my initial user interface layout! I go back to the code; double check what I did is correct, rebuild, STILL NO VISUAL CHANGE!

I did the previous steps several times when it hit me: the layout is stored/saved in the registry between executions! From the documentation:

  • Save and restore toolbar and menu states to the registry.

  • Access the workspace manager that persists customization settings to the registry.

     

    What if there would be a bug in that part? Thanks to that line in my wizard generated application class:

       SetRegistryKey(_T("Local AppWizard-Generated Applications"));

    I know where to look for the registry key I need to delete!

    By the way, I hope that by the time we release Visual C++ 10, we’ll finally have dropped those TCHAR.H macros! It’s close to 2009 and the world has definitively been going Unicode for a while now! But I digress…

    I rebuild my application again and try it: the last version of my user interface there! So there’s a bug in “our” MFC code.

    I ended up adding the following post-build event to each configuration for now:

       reg.exe DELETE "HKCU\Software\Local AppWizard-Generated Applications\$(TargetName)" /F