MFC: Change the toolbar buttons order but not update

志斌 罗 40 Reputation points
2023-12-12T08:00:56.6166667+00:00

User's image

As above. I changed the 4th and 5th buttons order, but not show correctly.

How to refresh it in my code?

I'm using VS 2019:

User's image

Thank you in advance!

zhibin.luo

Windows development | Windows API - Win32
Developer technologies | C++
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 49,636 Reputation points
    2023-12-12T08:42:33.8966667+00:00

    MFC applications created by the MFC App templates will usually save and restore UI from the registry after the first run. To see your changes after rebuilding the application delete the saved registry data before you run it again.

    The registry location is set in the InitIntance function. For example,

        // Standard initialization
        // If you are not using these features and wish to reduce the size
        // of your final executable, you should remove from the following
        // the specific initialization routines you do not need
        // Change the registry key under which our settings are stored
        // TODO: You should modify this string to be something appropriate
        // such as the name of your company or organization
        SetRegistryKey(_T("Local AppWizard-Generated Applications"));
    

    This is what the data looks like under HKCU -

    MFCUIRegistry

    Initial toolbar -

    Initial

    Revised Resource -

    ReorderedButtons

    After deleting the MFCTBButtonOrder registry key and subkeys -

    WithChanges

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.