{"id":37993,"date":"2004-09-01T07:00:00","date_gmt":"2004-09-01T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2004\/09\/01\/how-to-find-the-internet-explorer-binary\/"},"modified":"2004-09-01T07:00:00","modified_gmt":"2004-09-01T07:00:00","slug":"how-to-find-the-internet-explorer-binary","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20040901-00\/?p=37993","title":{"rendered":"How to find the Internet Explorer binary"},"content":{"rendered":"<p><P>\nFor some reason,\n<A HREF=\"http:\/\/ieview.mozdev.org\/\">\nsome people go to enormous lengths to locate the Internet Explorer\nbinary<\/A> so they can launch it with some options.\n<\/P>\n<P>\nThe way to do this is not to do it.\n<\/P>\n<P>\nIf you just pass &#8220;IEXPLORE.EXE&#8221; to\n<A HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/shellcc\/platform\/shell\/reference\/functions\/shellexecute.asp\">\nthe ShellExecute function<\/A>\n[link fixed 9:41am],\nit will go find Internet Explorer and run it.\n<\/P>\n<PRE>\nShellExecute(NULL, &#8220;open&#8221;, &#8220;iexplore.exe&#8221;,\n             &#8220;http:\/\/www.microsoft.com&#8221;, NULL,\n             SW_SHOWNORMAL);\n<\/PRE>\n<P>\nThe ShellExecute function gets its hands dirty so you don&#8217;t have to.\n<\/P>\n<P>\n(Note: If you just want to launch the\nURL generically, you should use\n<PRE>\nShellExecute(NULL, &#8220;open&#8221;, &#8220;http:\/\/www.microsoft.com&#8221;,\n             NULL, NULL, SW_SHOWNORMAL);\n<\/PRE>\n<P>\nso that the web page opens in the user&#8217;s preferred web browser.\nForcing Internet Explorer should be avoided under normal circumstances;\nwe are forcing it here because the action is presumably being taken\nresponse to an explicit request to open the web page specifically\nin Internet Explorer.)\n<\/P>\n<P>\nIf you want to get your hands dirty, you can of course do it yourself.\nIt involves\n<A HREF=\"\/oldnewthing\/archive\/2003\/12\/26\/45979.aspx\">\nreading the specification from the other side<\/a>, this time\n<A HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/dnwue\/html\/ch11c.asp\">\nthe specification on how to register your program&#8217;s name\nand path<\/A> (&#8220;Registering Application Path Information&#8221;).\n<\/P>\n<P>\nThe document describes how a program should enter its properties\ninto the registry so that the shell can launch it. To read it\nbackwards, then, interpret this as a list of properties you (the launcher)\nneed to <STRONG>read from<\/STRONG> the registry.\n<\/P>\n<P>\nIn this case, the way\nto run Internet Explorer (or any other program)\nthe same way ShellExecute does\nis to look in\nHKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE (substituting\nthe name of the program if it&#8217;s not Internet Explorer you&#8217;re after).\nThe default value is the full path to the program and the\nthe &#8220;Path&#8221;  value specifies a custom path that you should prepend\nto the environment before launching the target program.\n<\/P>\n<P>\nWhen you do this,\n<STRONG>don&#8217;t forget<\/STRONG> to call\n<A HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/sysinfo\/base\/expandenvironmentstrings.asp\">\nthe <CODE>ExpandEnvironmentStrings<\/CODE> function<\/A>\nif the registry value&#8217;s type is <CODE>REG_EXPAND_SZ<\/CODE>.\n(Lots of people forget about <CODE>REG_EXPAND_SZ<\/CODE>.)\n<\/P>\n<P>\nOf course, my opinion is that it&#8217;s much easier just to let\nShellExecute do the work for you.\n<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For some reason, some people go to enormous lengths to locate the Internet Explorer binary so they can launch it with some options. The way to do this is not to do it. If you just pass &#8220;IEXPLORE.EXE&#8221; to the ShellExecute function [link fixed 9:41am], it will go find Internet Explorer and run it. ShellExecute(NULL, [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-37993","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>For some reason, some people go to enormous lengths to locate the Internet Explorer binary so they can launch it with some options. The way to do this is not to do it. If you just pass &#8220;IEXPLORE.EXE&#8221; to the ShellExecute function [link fixed 9:41am], it will go find Internet Explorer and run it. ShellExecute(NULL, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/37993","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=37993"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/37993\/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=37993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=37993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=37993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}