digitalmars.D.learn - Re: Examples of Windows services in D?
- DNewbie <run3 myopera.com> Feb 22 2012
- Graham Fawcett <fawcett uwindsor.ca> Feb 23 2012
Here is a simple service in D http://my.opera.com/run3/blog/2012/02/23/windows-services-in-d It's basically c translated to d. On Tue, Feb 21, 2012, at 03:08 PM, Graham Fawcett wrote:Hi folks, I've got a Windows service that I'd like to write in D, if possible. I see that Andrej Mitrovic has provided a binding for the relevant parts of the Windows API (thanks!): https://github.com/AndrejMitrovic/DWinProgramming/blob/master/win32/ winsvc.d Has anyone used this (or another binding) to write an actual service? Particularly, I was hoping to find a "base class" that takes care of common tasks (installing, removing, starting, etc.). Thanks! Graham
Feb 22 2012
On Thu, 23 Feb 2012 02:33:04 +0100, DNewbie wrote:Here is a simple service in D http://my.opera.com/run3/blog/2012/02/23/windows-services-in-d It's basically c translated to d.
Hey, thanks for this. I ended up doing the same thing (translating an existing service from C++). But my code is messy, and I shall mine your example for improvements. :) I am *very* glad I could write this thing in D! One thing that bit me: if you want to use an extended Service Control Handler (RegisterServiceCtrlHandlerEx), these functions are absent from advapi32.lib (at least in my recent version of DMD). I had to include a linkage.def file, when linking, to get it working: EXETYPE NT IMPORTS RegisterServiceCtrlHandlerExA 12 = advapi32.RegisterServiceCtrlHandlerExA Cheers, GrahamOn Tue, Feb 21, 2012, at 03:08 PM, Graham Fawcett wrote:Hi folks, I've got a Windows service that I'd like to write in D, if possible. I see that Andrej Mitrovic has provided a binding for the relevant parts of the Windows API (thanks!): https://github.com/AndrejMitrovic/DWinProgramming/blob/master/win32/ winsvc.d Has anyone used this (or another binding) to write an actual service? Particularly, I was hoping to find a "base class" that takes care of common tasks (installing, removing, starting, etc.). Thanks! Graham
Feb 23 2012








Graham Fawcett <fawcett uwindsor.ca>