Delphi service debugging

I’ve literally spent over 3 hours trying to egt a delphi 5 service debugged. I tried all mentioned stuff with process attaching, registry stuff, etc, nothing worked. then I bumped into this post from wilson:
http://groups.google.com/group/borland.public.delphi.nativeapi.win32/browse_thread/thread/c2928189fd093193/686224ed4bc7f9a8?hl=en&lnk=st&q=delphi+debug+service+Image+File+Execution+Options#686224ed4bc7f9a8

that didn’t work out of the box eitehr because I’ve got an access violation on the line

while not Terminated do
  ServiceThread.ProcessRequests(True);// wait for termination

but I replaced that block of code with


if FindCmdLineSwitch('debug', ['/','-'], true) then
  while not Terminated do
    forms.Application.ProcessMessages 
else
  while not Terminated do
    ServiceThread.ProcessRequests(True);// wait for termination

and I can now debug my service just fine.

Related posts

2 Responses to “Delphi service debugging”

  1. Gail Honeyman says:

    What an excellent blog, I’ve added your feed to my RSS reader. 🙂

Leave a Reply

This blog is kept spam free by WP-SpamFree.