{"id":17293,"date":"2009-07-30T10:00:00","date_gmt":"2009-07-30T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2009\/07\/30\/what-is-the-difference-between-csidl_desktop-and-csidl_desktopdirectory\/"},"modified":"2009-07-30T10:00:00","modified_gmt":"2009-07-30T10:00:00","slug":"what-is-the-difference-between-csidl_desktop-and-csidl_desktopdirectory","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20090730-00\/?p=17293","title":{"rendered":"What is the difference between CSIDL_DESKTOP and CSIDL_DESKTOPDIRECTORY?"},"content":{"rendered":"<p>Among the various <code>CSIDL<\/code> values you can pass to functions like <code>SHGetSpecialFolderLocation<\/code> are <code>CSIDL_DESKTOP<\/code> and <code>CSIDL_DESKTOPDIRECTORY<\/code>. What&#8217;s the difference between them?\n The <code>CSIDL_DESKTOP<\/code> is the virtual folder that represents the desktop. The contents of this virtual folder is what gets displayed on top of your wallpaper.\n The <code>CSIDL_DESKTOP<\/code> virtual folder is populated from various locations, some of them virtual, and some of them physical. The <code>CSIDL_DESKTOPDIRECTORY<\/code> special folder is a physical folder that contains the files that you think of as on your desktop. These are the files that you&#8217;ve saved to your desktop, files that you&#8217;ve dragged to your desktop, that sort of thing. Some files on the desktop come from <code>CSIDL_COMMON_DESKTOPDIRECTORY<\/code>, which is the shared desktop. Files in the shared desktop directory are visible to all users.\n What does this mean for you, the programmer? (Well, assuming you are still using <code>CSIDL<\/code> values and haven&#8217;t switched over to the new <code>FOLDERID<\/code> model.)\n Programs shouldn&#8217;t care about <code>CSIDL_DESKTOPDIRECTORY<\/code>; they should just operate on <code>CSIDL_DESKTOP<\/code>, because that&#8217;s what the user sees. If you want to generate an <code>ITEMIDLIST<\/code> for a file on the desktop, use the <code>CSIDL_DESKTOP<\/code> folder. The physical folder behind the desktop can change (for example, due to <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/06\/30\/434209.aspx\"> roaming user profiles<\/a>), but the logical location on the desktop remains fixed. If you had generated the <code>ITEMIDLIST<\/code> based on  <code>CSIDL_DESKTOPDIRECTORY<\/code>, then the experience for your users will be much more annoying: They will get file not found errors if the user profile roams to another machine (since the directory has changed). If they perform a <i>Save As<\/i> operation, the default save location will be some deep file system path instead of just being the desktop.<\/p>\n<p> The <code>CSIDL_DESKTOPDIRECTORY<\/code> is the plumbing behind the scenes. Don&#8217;t show it to the user; it&#8217;s ugly. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Among the various CSIDL values you can pass to functions like SHGetSpecialFolderLocation are CSIDL_DESKTOP and CSIDL_DESKTOPDIRECTORY. What&#8217;s the difference between them? The CSIDL_DESKTOP is the virtual folder that represents the desktop. The contents of this virtual folder is what gets displayed on top of your wallpaper. The CSIDL_DESKTOP virtual folder is populated from various locations, [&hellip;]<\/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-17293","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Among the various CSIDL values you can pass to functions like SHGetSpecialFolderLocation are CSIDL_DESKTOP and CSIDL_DESKTOPDIRECTORY. What&#8217;s the difference between them? The CSIDL_DESKTOP is the virtual folder that represents the desktop. The contents of this virtual folder is what gets displayed on top of your wallpaper. The CSIDL_DESKTOP virtual folder is populated from various locations, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/17293","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=17293"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/17293\/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=17293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=17293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=17293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}