{"id":19,"date":"2008-10-22T10:59:47","date_gmt":"2008-10-22T18:59:47","guid":{"rendered":"http:\/\/blog.gerrior.com\/?p=19"},"modified":"2011-11-04T09:57:33","modified_gmt":"2011-11-04T17:57:33","slug":"preventing-renamed-app-from-creating-new-registry-entry","status":"publish","type":"post","link":"https:\/\/blog.gerrior.com\/?p=19","title":{"rendered":"Preventing Renamed App From Creating New Registry Entry"},"content":{"rendered":"<p style=\"text-align: left;\">In Visual Studio 2008, I was using MFC&#8217;s registry calls to save my program preferences. \u00a0The problem was new builds weren&#8217;t using the prior build&#8217;s settings. I was adding the build number to the <tt>.exe<\/tt> filename and this caused a new key to be created in the registry based on the <tt>.exe<\/tt> name and a new set of settings saved therein. \u00a0Inspecting <tt>CWinApp<\/tt>&#8216;s\u00a0<tt>m_pszAppName<\/tt>\u00a0and\u00a0<tt>m_pszExeName<\/tt>\u00a0I saw both were\u00a0<tt>PuffinApp914<\/tt>. \u00a0It turns out\u00a0<tt>m_pszAppName<\/tt> is set to the string resource ID <tt>AFX_IDS_APP_TITLE<\/tt> if it&#8217;s there. \u00a0If <tt>AFX_IDS_APP_TITLE<\/tt> doesn&#8217;t exist then <tt>m_pszAppName<\/tt> is set to the <tt>.exe<\/tt> filename. \u00a0After adding\u00a0<tt>AFX_IDS_APP_TITLE<\/tt>\u00a0to the project&#8217;s string resources\u00a0<tt>m_pszAppName<\/tt> became <tt>Puffin<\/tt> and\u00a0<tt>m_pszExeName<\/tt> stayed with\u00a0<tt>PuffinApp914<\/tt>. \u00a0The registry calls use\u00a0<tt>m_pszAppName<\/tt>\u00a0for the key so my problem was solved.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Visual Studio 2008, I was using MFC&#8217;s registry calls to save my program preferences. \u00a0The problem was new builds weren&#8217;t using the prior build&#8217;s settings. I was adding the build number to the .exe filename and this caused a new key to be created in the registry based on the .exe name and a &hellip; <a href=\"https:\/\/blog.gerrior.com\/?p=19\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Preventing Renamed App From Creating New Registry Entry<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-mfc","category-windows"],"_links":{"self":[{"href":"https:\/\/blog.gerrior.com\/index.php?rest_route=\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.gerrior.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.gerrior.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.gerrior.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.gerrior.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":4,"href":"https:\/\/blog.gerrior.com\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":412,"href":"https:\/\/blog.gerrior.com\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions\/412"}],"wp:attachment":[{"href":"https:\/\/blog.gerrior.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.gerrior.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.gerrior.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}