{"id":27063,"date":"2007-04-30T10:00:00","date_gmt":"2007-04-30T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/04\/30\/the-default-verb-is-not-necessarily-open\/"},"modified":"2007-04-30T10:00:00","modified_gmt":"2007-04-30T10:00:00","slug":"the-default-verb-is-not-necessarily-open","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070430-00\/?p=27063","title":{"rendered":"The default verb is not necessarily &#034;open&#034;"},"content":{"rendered":"<p>If you hunt around the Internet you&#8217;ll find lots of people&dagger; who hard-code the string <code>\"open\"<\/code> as the second parameter to the <code>ShellExecute<\/code> function, indicating that they want to open the document specified as the third parameter. While that&#8217;s a nice thing to want to do, it might not be the right thing.\n When the user double-clicks a document, the shell executes the default verb, which is not necessarily &#8220;open&#8221;. For example, for audio files, the default verb is often &#8220;play&#8221;, and for pictures, it&#8217;s often &#8220;view&#8221;. If you want to launch the document as if the user had double-clicked it, then you need to pass <code>NULL<\/code> as the <code>lpOperation<\/code>.\n Commenter brad asked <a href=\"http:\/\/weblogs.asp.net\/oldnewthing\/archive\/2004\/09\/29\/235737.aspx#236161\"> how the default verb is determined<\/a>. This is explained in MSDN in the section titled, not surprisingly, <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/shellcc\/platform\/shell\/programmersguide\/shell_basics\/shell_basics_extending\/fileassociations\/fa_intro.asp\"> Verbs and File Associations<\/a>:<\/p>\n<blockquote class=\"q\"><p> The primary verb is specified by the default value of the <b>shell<\/b> key, or the <b>open<\/b> key if the <b>shell<\/b> key has no default value. &#8230; The primary verb is also referred to as the default verb. <\/p><\/blockquote>\n<p> <b>Nitpicker&#8217;s corner<\/b><\/p>\n<p> &dagger;The phrase &#8220;lots of people&#8221; means &#8220;lots of people&#8221;. <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/07\/13\/664448.aspx\"> It doesn&#8217;t mean &#8220;lots of people not including Microsoft.&#8221;<\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you hunt around the Internet you&#8217;ll find lots of people&dagger; who hard-code the string &#8220;open&#8221; as the second parameter to the ShellExecute function, indicating that they want to open the document specified as the third parameter. While that&#8217;s a nice thing to want to do, it might not be the right thing. When the [&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-27063","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>If you hunt around the Internet you&#8217;ll find lots of people&dagger; who hard-code the string &#8220;open&#8221; as the second parameter to the ShellExecute function, indicating that they want to open the document specified as the third parameter. While that&#8217;s a nice thing to want to do, it might not be the right thing. When the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/27063","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=27063"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/27063\/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=27063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=27063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=27063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}