0

My goal isto have a WPF application run in both console mode and GUI mode. Everything worked fine until I realized that from command line it does not return back to prompt and neither is the exit code being set properly. Something similar to this post:

wpf console application not returning to prompt

So, I went through a workaround. I set the project output type to Console and things work good expect the fact that when double clicking to start the WPF application it shows both the GUI and a console window which is an annoying experience.

So, I am planning to hide that console window, but hide it ONLY if the WPF application was launched by double clicking. Is there anyway to find out if the WPF application was launched by double clicking ?

Community
  • 1
  • 1
Frank Q.
  • 6,001
  • 11
  • 47
  • 62

1 Answers1

0

You could create a shortcut to your app on a desktop, adding a startup parameter to the startup path in you *.lnk file. After starting app you can check this parameter.

Yurii Zhukow
  • 345
  • 1
  • 2
  • 10
  • I am shipping my application as an EXE. So, creating shortcut wont happen. Any other alternative ? – Frank Q. Sep 06 '12 at 19:30
  • You can create shortcut programmatically, for example at first start. I suppose, there is no another alternative to do what you want. – Yurii Zhukow Sep 07 '12 at 05:33