Link to home
Start Free TrialLog in
Avatar of Ajit_Kr
Ajit_KrFlag for India

asked on

How to call console/window/desktop application from a window service...?

How to call console/window/desktop application from a window service...
so that console or form should appear on screen for user interaction....
right now it is running in background.. i.e. not appearing on screen for user interaction..


please help..!  
Avatar of HainKurt
HainKurt
Flag of Canada image

what is your current code?
SOLUTION
Avatar of kaylanreilor
kaylanreilor
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ajit_Kr

ASKER

Process myProcess = new Process();
                myProcess.StartInfo.UseShellExecute = false;
                myProcess.StartInfo.FileName = exepath;
                myProcess = System.Diagnostics.Process.Start(myProcess.StartInfo.FileName, System.Environment.UserName);
                myProcess.WaitForExit(200);
                Console.ReadLine();
Avatar of Ajit_Kr

ASKER

here is complete code I am using...
Service1.cs
Avatar of Ajit_Kr

ASKER

mainly I have to execute a console application in which there will be some question - answer session with the user.. i.e. console application need user interaction..
 
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ajit_Kr

ASKER

it is done but still it is not showing..
What is the OS?  What is the session the service is running in ?
For post-Vista OS your service is running in session 0 and then, since the application cannot run in session 0, are we sure that there is no issue here ?
Avatar of Ajit_Kr

ASKER

OS is xp & win 2003

console application now started executing but only sometimes... means 1 outof 5 time console app execute..

what is this issue..?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ajit_Kr

ASKER

No I am not closing the question... I have accepted the multiple solution..