Drew Wutka
DWUTKA at Marlow.com
Thu Jun 16 17:08:46 CDT 2011
An NT Service (as you are calling it a Windows Service) is an executable that is running on your machine and it has several different 'properties'. First, the type of startup... either manual, disabled or automatic. Automatic starts when you computer starts. Disabled means the service won't start. Secondly, there is an 'interactive' option, that determines if a service can run with an interface. For this to work, it has to have user credentials. Services with a user interface can run into all sorts of issues. I personally haven't built a service in .net yet, but have had lots of experience with them in VB 6. What you really want to do is build a service that has no interface, and then build a program that 'controls' that program. This can be done in many ways, either you can have the control change values in a database or file, that the service utilizes, or you can create various 'talking' methods, like named pipes, tcp/ip comms, etc, that allows the controlling program to directly talk to the service. Drew -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Francisco Tapia Sent: Thursday, June 16, 2011 10:58 AM To: Discussion concerning Visual Basic and related programming issues. Subject: [dba-VB] A windows Service or Not a service? I wrote a simple application that has a form and two buttons (along with a timer). My initial idea was that I would write this to be a windows service so it would auto-start whenever a specific server would reboot etc. The purpose is that I need to get new records created by a "Vendor" application and have them sent to a Second "Vendor" system. I call a custom view that I wrote that collects that last set of changes, then record by record calls a webservice on our SAP system and pushes in the new changes. My sql server version is Sql Server 2000 so it's not as easy as just writing a soap object to make the webservice call, I think it was much easier to just write the app in c# and make the call that way, which works. NOW for the tricky part. I wanted to write up the app to create a windows service installer so that my admins could log into the windows server and either start or stop the application, I also wanted to provide a gui view to the windows service so that they could choose a different timer so it could run every 1 minute (every 2 minutes, etc..) what ever they would choose. after reading MS's description on windows service classes, I noticed that supposedly the .Net Studio does not support this, but I've seen other apps that DO provide a gui view to the windows service that they introduce. so my question to the group is, have you done this before? and if so how did you go about it? -- http://msdn.microsoft.com/en-us/library/d56de412%28v=VS.90%29.aspx The Windows service classes supported by the .NET Framework do not support interaction with interactive stations, that is, the logged-on user. The .NET Framework also does not include classes that represent stations and desktops. If your Windows service must interact with other stations, you will need to access the unmanaged Windows API. For more information, see Window Stations<http://msdn.microsoft.com/en-us/library/ms687096%28v=VS.90%29.a spx>and Desktops<http://msdn.microsoft.com/en-us/library/ms682573%28v=VS.90%29.a spx>in the Platform SDK documentation. -Francisco http://bit.ly/sqlthis | Tsql and More... http://db.tt/JeXURAx | Drop Box, Storage in the Cloud (free) _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.