Hey, I'm trying to get a service to start my program, but it's not showing the GUI The process starts but nothing is shown. I have tried to enable 'Allow service to interact with desktop' but that still does not work. My program is a computer locking device to prevent unauthorized users from accessing the computer. I am running Windows 7 with a 64 bit OS.
Here is the code for my service:
protected override zero onstart (string [] args) {process p = new process (); P.StartInfo.FileName = "notepad.exe"; P.Start (); FileStream FS = New FileStream (@ "C: \ User \ David \ Document \ Visual Studio 2010 \ Projects \ Lockpace Service \ Lockpace Service \ Bin \ Debug \ ServiceLog. DJ", Flamemade. OpenOrc, FileService. StreamWriter m_streamWriter = New Streamer (FS) ; M_streamWriter.BaseStream.Seek (0, SeekOrigin.End); M_streamWriter.WriteLine ("LockPCService: Service Started" + Date Time.Now "" \ n "+" \ n "); m_streamWriter.Flush (); m_streamWriter Close ();} Safe Override Zero Ontop () {FileStream FS = New FileStart Email (@ "C: \ User \ David \ Document \ Visual Studio 2010 \ Projects \ LockPysSew \ LockpaceService \ Bin \ Debug \ ServiceLog.dj", FliemMode. OpenOrcure, Write File); StreamWriter m_streamWriter = New Streamer (FS); M_streamWriter.BaseStream.Seek (0, SeekOrigin.End); M_streamWriter.WriteLine ("LockPCService: Service off" + Date Time.Now + "\ n"); m_streamWriter.Flush (); m_streamWriter.Close ();}
To try and get the service I am using notepad.exe. When I run the Notepad to the procedures, but there is no GUI, there is also a service log and every time I work in running it.
Any idea why this is not working?
Thank you.
indicates that session 0 isolation
which among other things is Windows Vista Creating a UI in / 7 does not allow the services. Another process begins in your service, this session starts in 0 and will not show any UI. (By the way, the UI is made, this is just that Session 0 is never displayed). On CodeProject, you can find a process from a service on the user's desktop and can show its UI.
Also, please consider wrapping one item in the stream so that they are properly disposed.
Comments
Post a Comment