简体   繁体   中英

MFC: Registry key for the application has random GUID keys added with a blank REG_SZ value named “Untitled”?

I noticed that my MFC based applications (also using BCGControlBar Pro) is creating several keys under the application key with a GUID (eg Computer\HKEY_CURRENT_USER\SOFTWARE\Acme\Program Name\3CF4873E-E8CC-4e67-A3D2-56F5B610B4FA ). In those keys are a single REG_SZ value named Untitled with the Data blank (empty string).

This must be something the framework is doing because I don't create them. What are these and how do I stop it from happening?

Thanks.

The problem was as @Adrian Mole suspected above. It has to do with the Restart Manager implementation in MFC. The interesting thing is I couldn't reproduce the problem in a Debug build, only a Release build.

Since my application really isn't document based where you open and save a file, I was able to solve it by changing the option in the MFC CWinApp class for my application from:

m_dwRestartManagerSupportFlags=AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS;

to

m_dwRestartManagerSupportFlags=AFX_RESTART_MANAGER_SUPPORT_RESTART | AFX_RESTART_MANAGER_SUPPORT_RECOVERY;

Also, in the windows-classic-samples-master you'll find a rmfilterapp you can modify to easily test your app using the Restart Manager.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM