Re: Convert Program to a Service?
From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 07/29/04
- Next message: Joseph M. Newcomer: "Re: ? Handling right clicks on buttons"
- Previous message: Don Metzler: "Re: calculate font size to fit text in a RECT?"
- In reply to: Brucer: "Re: Convert Program to a Service?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 29 Jul 2004 17:13:58 -0400
I teach through Hands On Technology Transfer (www.trraininghott.com) and in fact there
will be a course next week. I don't know when the next one after that is scheduled
(although they list lots of potential cities, they need at least four students to
register, so it is actually taught about six times a year, to classes between four and
twelve students)..
Ron Reeves and Marshall Brain have a book on Windows System Programming, which is very
good; the example in my course is a minor adaptation of their example. Their example in
turn is based on the example in the MSDN documentation. There is a link on my Web site to
the Reeves/Brain book. Check out my section on Win32 Books on my site.
joe
On Thu, 29 Jul 2004 10:02:02 -0700, Brucer <Brucer@discussions.microsoft.com> wrote:
>Joe,
>
>Thanks for the advice. Is your Systems Programming Course one that I can take (or can you point me to some place on your web site, in a good book, or elsewhere that has a similar example of writing a basic service?
>
>thanks, bruce
>
>"Joseph M. Newcomer" wrote:
>
>> In general, it is much better to write a service than to try to use one of the application
>> wrappers. There are things you need to worry about when you are a service that would make
>> no sense as an application. You will get a better result.
>>
>> I've done a few tricks that make it easier to debug, but with the newer debuggers, this is
>> less an issue. There used to be serious problems trying to attach the debugger to a
>> service, so I wrote three programs: a service, which called functions which I either put
>> in a DLL or compiled into the service; a console or GUI program, which called the same
>> functions; and a collection of modules that were either directly included, compiled as a
>> ..lib file, or compiled as a DLL, which were the actual functionality of the service. This
>> made it real easy to develop a program, debug it, and then make it a service. But starting
>> with VS6, there was no longer a need to do that because it was easy and reliable to simply
>> connect the debugger to a running service. So once I got it to run at all, the hard parts
>> of the debugging proceeded as any other debugging.
>>
>> But I'd advise just biting the bullet and writing a service as a service. It isn't that
>> hard (it is, for example, a 90-minute lab in my Systems Progarmming course to type in a
>> service, get it running, and connect to it and find the bug). So I don't consider it a
>> major effort.
>> joe
>>
>> On Wed, 28 Jul 2004 19:43:00 +0200, "M. Kools" <mkools@vangennep.nl> wrote:
>>
>> >Two options:
>> >1) Simple solution. There are programs out there on the web which
>> >enables you to run any executable as a service
>> >2) Programming solution. Writing a service isn't all too hard, there's
>> >some class available on the codeproject:
>> >http://www.codeproject.com/system/cntservice.asp for the explaination of
>> >the whole thing, and an updated version on his website:
>> >http://www.naughter.com/serv.html
>> >
>> >If you make this a service, be sure not to output anything to a console
>> >window, it made our service crash quite often
>> >
>> >Brucer wrote:
>> >
>> >> All,
>> >>
>> >> I have a "batch" program that listens to TCP/IP traffic, and acts on certain messages. No user interaction is required. I would like it to start when the user logs on or the computer starts, and more importantly, if it crashes, it would be nice for the system to restart it for me. A System Service seems like the right answer.
>> >>
>> >> Is a Service the right way to do this, and Is there an easy way to take a simple executable and install it as a service? Or, does the program need to be built specially for this to work? I am using Visual C++ 6.0
>> >>
>> >> Any pointers to references on how to accomplish this would be appreciated
>> >>
>> >> thanks, bruce
>>
>> Joseph M. Newcomer [MVP]
>> email: newcomer@flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
- Next message: Joseph M. Newcomer: "Re: ? Handling right clicks on buttons"
- Previous message: Don Metzler: "Re: calculate font size to fit text in a RECT?"
- In reply to: Brucer: "Re: Convert Program to a Service?"
- Messages sorted by: [ date ] [ thread ]