Xi Vix
Xi Vix

Reputation: 1361

Visual Studio 2010 c# process.start being ignored

I put this line of code in my program:

System.Diagnostics.Process.Start("firefox.exe", "http://sample.com//page.html");

and I also tried with the full path:

System.Diagnostics.Process.Start("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", "http://sample.com//page.html");

I have the appropriate using statements.
My problem is the line is being completely ignored.
Since there are no errors or aborts then a try/catch won't help.
What am I missing?

Note: does it make a difference that my program is running as a windows service?

Upvotes: 0

Views: 151

Answers (1)

user585968
user585968

Reputation:

You have indicated you are running as a Windows Service. WS by default may not interact with the desktop which generally means spawned GUI processes won't appear either.

You have two choices

  1. Change your app so that it is not a Windows Service
  2. Change the settings in Computer Management.Services. right-click, Properties; Log-on tab and tick Allow service to interact with desktop.

Interact with desktop is not entirely recommended as it sorts of defeats the purpose of services. Plus it may require that you are logged in in order to work

Upvotes: 2

Related Questions