Question Windows service

fazalbhi

New member
Joined
Jan 24, 2008
Messages
2
Programming Experience
1-3
Hi all,
I am developing a windows service and starting a process(using process.start("notepad.exe")) from its onstart() method.But its not working.I don't want to tick Allow interact with desktop by user.In order to archive it i used the APIs Setproceeswindowstation(), and setthreaddesktop.But it seems not working.I can see the process in task manager but the window not appears.Anyone know what is the problem and what I did wrong?

Thanks in advance for all ur help!
 
You should look up Process class and ProcessStartInfo class in help documentation for starters, there are lots of code samples in documentation.
 
Nothing I code in my windows service is firing

I am at my wits end on this one. Starting to think writing a windows service using vb.net is a total waste of time. I wrote a simple windows service to turn on/off the screen saver. I placed a timer in my service and added my code to it's tick event. I got nothing at all. I put a message box in the OnStart event of the service and that fired fine but any code in the timer was almost like it didn't exist. Looking around Google showed me a work around using the threading.timer object instead....ok fine, doesn't make any sense to me why a windows component would just not work but fine. Now I place a notifyicon in my project so it will be displayed in the systray and that works fine but I can not get any code in my notifyicon to fire at all. I placed a simple message box in the click event, the mouse move event and the double click event for the notifyicon and nothing, bupkis. Can anyone please explain to me what or who I have to kill to get something to actually work in this service? Having to figure out how to code the work I actually need performed is hard enough without having to help debug the ide as well.

Sorry for the long post/tirade but I am completely frustrated by all this. I feel like I have wasted hours researching something as simple as how to get a message box (or anything else for that matter) to fire in any of these various events.

Thanks in advance for any and all help!

supreme_good
 
Last edited:
You probably have, the best approach to windows services is to forget forms and UI, forget there exist a user desktop, and start thinking multithreading instead of events. This introduction is from "windows service" help topics:
MSDN said:
Microsoft Windows services, formerly known as NT services, enable you to create long-running executable applications that run in their own Windows sessions. These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface. These features make services ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer.
You should also read the rest of Introduction to Windows Service Applications
 
Back
Top