Has anyone ever tried to attach delphi to his own windows service(32 bit app.) process under Windows Server 2008 64 bit?
When I try to do this I get the error:
Unable to create the process. The parameter is incorrect.
if anyone of you know how to do this, that help would be really appreciated.
Thanks!
Whilst you can debug a Delphi service there are a number of hoops that you need to jump through to make it work. I never bother and simply ensure that my services can run either as a service or as a standard app. When I want to debug I run as a standard app and so sidestep all the headaches.
I’ve hacked out all the code into a single file for the purpose of this answer, but you’d want to structure it a bit differently.
To use this you need to create a new class, inherited from
TMyService, and implementInitialiseandCreateRunner.CreateRunneris the key. In my services this creates an object which in turn opens a listening socket ready for clients to communicate over.The standard app code is pretty basic. It doesn’t even have a mechanism to terminate—it runs inside a
while Trueloop. That doesn’t matter for my debugging needs.