{"id":103801,"date":"2020-05-27T07:00:00","date_gmt":"2020-05-27T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=103801"},"modified":"2020-05-27T05:44:33","modified_gmt":"2020-05-27T12:44:33","slug":"20200527-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20200527-00\/?p=103801","title":{"rendered":"The SetClientGuid method of the common file and folder dialogs lets you give names to those dialogs, too"},"content":{"rendered":"<p>We saw a little while ago that <a href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20200525-00\/?p=103789\"> the SettingsIdentifier property of the various file pickers lets you give names to your pickers<\/a>. Those work for the Windows Runtime pickers, but what if you&#8217;re using the old-fashioned Win32 pickers?<\/p>\n<p>There is an analogous feature in the Win32 file and folder pickers: You can call the <code>IFile\u00adDialog::<wbr \/>Set\u00adClient\u00adGuid<\/code> method with a GUID that names your dialog.\u00b9 As before, you can use different GUIDs for different scenarios in your program, and each of those scenarios will retain their settings separately.<\/p>\n<p>The <code>IFile\u00adDialog<\/code> is a base interface of both the <code>IFile\u00adOpen\u00adDialog<\/code> and <code>IFile\u00adSave\u00adDialog<\/code> interfaces, so you get this functionality in file open and save dialogs, as well as the folder picker dialog, which is just a file picker that has been configured with the <code>FOS_<wbr \/>PICK\u00adFOLDERS<\/code> option.<\/p>\n<p>On the Win32 side, you also have the bonus method <code>IFile\u00adDialog::<wbr \/>Clear\u00adClient\u00adData()<\/code> which tells the system to forget the settings that were associated with the client GUID. The next time a dialog with that GUID is displayed, it will show up with the defaults.<\/p>\n<p>\u00b9 Unlike the Windows Runtime case, where names from different apps are kept separate, in the Win32 case, the GUID is kept in a global namespace, so make sure to use some GUID unique to your program, rather than some value that might collide with one chosen by another program.\u00b2<\/p>\n<p>\u00b2 On the other hand, if you have multiple programs that work together, you might intentionally use the same GUID in all of them, so that they share state. For example, if you have a suite of programs that all have an &#8220;Export as Contoso Archive&#8221; command, maybe you want them all to export to the same place.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sort of like Bob and Carol for Win32.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-103801","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Sort of like Bob and Carol for Win32.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/103801","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=103801"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/103801\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=103801"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=103801"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=103801"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}