{"id":2523,"date":"2006-01-23T17:25:00","date_gmt":"2006-01-23T17:25:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/heaths\/2006\/01\/23\/suppressing-console-windows-for-custom-actions\/"},"modified":"2006-01-23T17:25:00","modified_gmt":"2006-01-23T17:25:00","slug":"suppressing-console-windows-for-custom-actions","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/setup\/suppressing-console-windows-for-custom-actions\/","title":{"rendered":"Suppressing Console Windows for Custom Actions"},"content":{"rendered":"<p>If you have authored a custom action into your installer package and are\nannoyed by the console window that always pops up when the custom action runs,\nit&#8217;s because the custom action executable is running under the console\nsubsystem.<\/p>\n<p>When you link your object files with the VC++ linker you can\nspecify the subsystem using the\n<a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/fcc1zstk.aspx\">\n\/SUBSYSTEM switch<\/a>. If you&#8217;re using the C# or VB.NET compilers the\n<a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/31xs5fhx(en-US,VS.80).aspx\">\n\/target switch<\/a> allows you to specify which subsystem to use for the\nexecutable. However you specify the subsystem or however it&#8217;s determined depending on\nwhich entry point you use, you shouldn&#8217;t use the console subsystem for custom\nactions if you don&#8217;t want the console window to appear, unless you have a good\nreason for it. For example, maybe you just want to reuse a console application\nthat you&#8217;re installing such as for\n<a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/custom_action_type_18.asp\">custom action type 18<\/a>\nor any custom action using <code>msidbCustomActionTypeExe<\/code> (0x01).<\/p>\n<p>In most cases you should consider running under the Windows subsystem. No\nwindow is created unless you create a window yourself and you can still\n<a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/dllproc\/base\/allocconsole.asp\">\nallocate a console<\/a> if necessary.<\/p>\n<p>If you already have a console EXE you want to use, you can cause the window\nnot to be displayed by passing certain parameters to APIs like the <code>CreateProcess<\/code>\nfunction. When calling <code>CreateProcess<\/code> pass <code>CREATE_NO_WINDOW<\/code> (0x08000000).\n<a href=\"http:\/\/wix.sourceforge.net\/\">WiX<\/a> defines the <code>CAQuietExec<\/code> custom\naction function that does this and redirects standard handles as well.<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have authored a custom action into your installer package and are annoyed by the console window that always pops up when the custom action runs, it&#8217;s because the custom action executable is running under the console subsystem. When you link your object files with the VC++ linker you can specify the subsystem using [&hellip;]<\/p>\n","protected":false},"author":389,"featured_media":3843,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[20],"class_list":["post-2523","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-installation"],"acf":[],"blog_post_summary":"<p>If you have authored a custom action into your installer package and are annoyed by the console window that always pops up when the custom action runs, it&#8217;s because the custom action executable is running under the console subsystem. When you link your object files with the VC++ linker you can specify the subsystem using [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/2523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/users\/389"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/comments?post=2523"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/2523\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media\/3843"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media?parent=2523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/categories?post=2523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/tags?post=2523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}