{"id":25083,"date":"2007-09-18T10:00:00","date_gmt":"2007-09-18T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/09\/18\/why-is-my-delay-rendered-format-being-rendered-too-soon\/"},"modified":"2022-08-02T06:57:13","modified_gmt":"2022-08-02T13:57:13","slug":"20070918-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070918-00\/?p=25083","title":{"rendered":"Why is my delay-rendered format being rendered too soon?"},"content":{"rendered":"<p>Here&#8217;s a customer question:<\/p>\n<blockquote class=\"m\"><p>I&#8217;ve put data on the clipboard as delay-rendered, but I&#8217;m getting a <code>WM_RENDERFORMAT<\/code> request for my <code>CF_HDROP<\/code> for many operations even though nobody actually looks at the files. Operations such as right-clicking a blank space on the desktop or opening the Edit menu. I don&#8217;t want to render the data until the user hits Paste because generating the data requires me to download the file from a Web server.<\/p><\/blockquote>\n<p>The <code>CF_HDROP<\/code> format is a list of file names, and at the time the format is generated, the files must already exist. That&#8217;s because the whole purpose of <code>CF_HDROP<\/code> is to describe files that already exist.<\/p>\n<p>These simple operations cause a request for <code>CF_HDROP<\/code> because, as a simple list of file names, it is expected to be a fast format. The data object merely has to provide a list of things that already exist; it doesn&#8217;t have to go make them. It&#8217;s interesting that the customer wants to delay generating the <code>CF_HDROP<\/code> format until the user selects Paste, because the shell is asking for <code>CF_HDROP<\/code> specifically to see whether it should enable the Paste command in the first place!<\/p>\n<p>That you shouldn&#8217;t generate dynamic data in response to <code>CF_HDROP<\/code> is also clear when you think about the lifetime issues. If you&#8217;re going to generate the files on the fly, when do you know that it&#8217;s safe to delete them? If the user drops the file onto Internet Explorer or Firefox, the Web browser is going to view the file as a Web page. You get no notification when the user closes the Web browser, and therefore you don&#8217;t know when it&#8217;s safe to delete the file. The <code>CF_HDROP<\/code> format describes files that already exist independent of the data object.<\/p>\n<p>What is the correct thing to do if you want to delay-render a virtual file? Use the FileGroupDescriptor clipboard format. That&#8217;s what it&#8217;s for: Delay-rendering of virtual file contents.<\/p>\n<p>(I&#8217;m assuming an advanced audience that knows how to use a FileGroupDescriptor. There will be a remedial course in the use of the FileGroupDescriptor sometime next year.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a customer question: I&#8217;ve put data on the clipboard as delay-rendered, but I&#8217;m getting a WM_RENDERFORMAT request for my CF_HDROP for many operations even though nobody actually looks at the files. Operations such as right-clicking a blank space on the desktop or opening the Edit menu. I don&#8217;t want to render the data until [&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-25083","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Here&#8217;s a customer question: I&#8217;ve put data on the clipboard as delay-rendered, but I&#8217;m getting a WM_RENDERFORMAT request for my CF_HDROP for many operations even though nobody actually looks at the files. Operations such as right-clicking a blank space on the desktop or opening the Edit menu. I don&#8217;t want to render the data until [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/25083","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=25083"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/25083\/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=25083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=25083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=25083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}