Thread overview
Examples of Windows services in D?
Feb 21, 2012
Graham Fawcett
Feb 21, 2012
Andrej Mitrovic
Feb 21, 2012
Graham Fawcett
Feb 23, 2012
DNewbie
Feb 23, 2012
Graham Fawcett
Sep 07, 2013
HeiHon
Aug 09, 2014
Tyler Jensen
Aug 09, 2014
Tyler Jensen
February 21, 2012
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
February 21, 2012
Noooo, it wasn't me. I keep having to tell this to people, it was taken from http://www.dsource.org/projects/bindings/wiki/WindowsApi but it often doesn't compile with the latest compiler version so I keep it updated inside my project.
February 21, 2012
On Tue, 21 Feb 2012 17:35:34 +0100, Andrej Mitrovic wrote:

> Noooo, it wasn't me. I keep having to tell this to people, it was taken from http://www.dsource.org/projects/bindings/wiki/WindowsApi but it often doesn't compile with the latest compiler version so I keep it updated inside my project.

Ah, sorry to spread misinformation, Andrej. :)

Graham
February 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
> 


February 23, 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,
Graham



> 
> 
> 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
>>

September 07, 2013
On Thursday, 23 February 2012 at 01:33:10 UTC, 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.
>

This example seems to have 404ed.

Is there an example of a simple service written in D2 somewhere?

I have a service written in D1 that works just fine. But I couldn't get it to work with D2 - I think I ran into the same problems as Steve Teale:

http://forum.dlang.org/thread/ic32he$2ifl$1@digitalmars.com

All other example code I could find also was D1 only.
August 09, 2014
I am very interested to find a good example for D2 of a Windows Service implementation. Can you point me to one?


On Saturday, 7 September 2013 at 13:57:07 UTC, HeiHon wrote:
> On Thursday, 23 February 2012 at 01:33:10 UTC, 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.
>>
>
> This example seems to have 404ed.
>
> Is there an example of a simple service written in D2 somewhere?
>
> I have a service written in D1 that works just fine. But I couldn't get it to work with D2 - I think I ran into the same problems as Steve Teale:
>
> http://forum.dlang.org/thread/ic32he$2ifl$1@digitalmars.com
>
> All other example code I could find also was D1 only.

August 09, 2014
Found this:

https://github.com/alvatar/snippets/blob/086f1714927df1338ac36b3633a3a91034a8347c/d/scrapple/bevutils/ServiceBase.d

Will be exploring it to see if I can make it work.


On Saturday, 9 August 2014 at 05:08:40 UTC, Tyler Jensen wrote:
> I am very interested to find a good example for D2 of a Windows Service implementation. Can you point me to one?
>
>
> On Saturday, 7 September 2013 at 13:57:07 UTC, HeiHon wrote:
>> On Thursday, 23 February 2012 at 01:33:10 UTC, 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.
>>>
>>
>> This example seems to have 404ed.
>>
>> Is there an example of a simple service written in D2 somewhere?
>>
>> I have a service written in D1 that works just fine. But I couldn't get it to work with D2 - I think I ran into the same problems as Steve Teale:
>>
>> http://forum.dlang.org/thread/ic32he$2ifl$1@digitalmars.com
>>
>> All other example code I could find also was D1 only.