INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Delphi Service Example

Delphi Service Example

(OP)
thread102-791024: Extract path from TService

In regard to the above thread. May I get you to provide the values for the following constants you use in your code example?

STR_REGKEY_SVC
STR_REGVAL_IMAGEPATH
STR_REGVAL_DESCRIPTION
STR_INFO_SVC_DESC
STR_REGKEY_EVENTMSG
STR_REGVAL_EVENTMESSAGEFILE
STR_REGVAL_TYPESSUPPORTED
STR_REGKEY_FULL
STR_REGVAL_INSTALLDIR

RE: Delphi Service Example


CODE

STR_VERSION_MAIN                = '1.0';
 STR_NAME_COMPANY                = 'YourCompany';
 STR_NAME_APPLICATION_SHORT      = 'YourApplicationName';
 STR_NAME_APPLICATION            = STR_NAME_COMPANY+' '+STR_NAME_APPLICATION_SHORT;
 STR_NAME_SVC                    = 'Svc_YourService';

 // service main registry keys
 STR_REGKEY_SOFTWARE             = '\Software';
 STR_REGKEY_COMPANY              = '\'+STR_NAME_COMPANY;
 STR_REGKEY_APPLICATION          = '\'+STR_NAME_APPLICATION_SHORT;
 STR_REGKEY_FULL                 = STR_REGKEY_SOFTWARE+STR_REGKEY_COMPANY+STR_REGKEY_APPLICATION+'\'+STR_VERSION_MAIN;
 STR_REGKEY_EVENTMSG             = '\SYSTEM\CurrentControlSet\Services\EventLog\Application\'+STR_NAME_APPLICATION;
 STR_REGKEY_SVC                  = '\SYSTEM\CurrentControlSet\Services\'+STR_NAME_SVC;

 STR_REGVAL_INSTALLDIR           = 'InstallDir';
 STR_REGVAL_IMAGEPATH            = 'ImagePath';
 STR_REGVAL_DEPENDONSERVICE      = 'DependOnService';
 STR_REGVAL_DESCRIPTION          = 'Description';
 STR_REGVAL_EVENTMESSAGEFILE     = 'EventMessageFile';
 STR_REGVAL_TYPESSUPPORTED       = 'TypesSupported';

 STR_INFO_SVC_DESC               = STR_NAME_APPLICATION+' '+STR_VERSION_MAIN;
 STR_INFO_SVC_REGFAIL            = 'Registry is not initialized for service';
 STR_INFO_SVC_START              = 'Starting service...';
 STR_INFO_SVC_STARTED            = 'Service has been started';
 STR_INFO_SVC_STARTFAIL          = 'Service failed to start : "%s"';
 STR_INFO_SVC_STOP               = 'Stopping service...';
 STR_INFO_SVC_STOPPED            = 'Service has been stopped';
 STR_INFO_SVC_STOPPEDWITHERROR   = 'Service stopped due to main thread error, please check debug log';
 STR_INFO_SVC_STOPFAIL           = 'Service failed to stop : "%s"';

 STR_INFO_SVC_NOCONFIG           = 'Unable to load service configuration file'; 

I hope this is enough :)

-----------------------------------------------------
Helping people is my job...

RE: Delphi Service Example

(OP)
Most definitely helps!!!! thumbsup2

Thank you. Very much appreciated.

RE: Delphi Service Example

(OP)
Okay. Would you happen to have the source code for these units as well? :D I'm converting an old Delphi 7 service to use a thread and have seen these units referenced on Stack Overflow, etc. However, source never provided.

  • u_eventlog
  • u_MyThread
ResonantEcho

RE: Delphi Service Example

(OP)
BTW, is it necessary to use the "u_eventlog" unit? Why not use TEventLogger instead?


// ResonantEcho

RE: Delphi Service Example

Quote:


BTW, is it necessary to use the "u_eventlog" unit? Why not use TEventLogger instead?

You do realize the original thread you referenced was 12 years ago when Delphi 7 was the most current Win32 option? Perhaps TEventLogger didn't exist then?

As for source: u_eventlog . Didn't find reference to the other.

RE: Delphi Service Example

Yes, code is a bit dated but still usable.
Nothing stops you from using TEventlogger :)

/Daddy

-----------------------------------------------------
Helping people is my job...

RE: Delphi Service Example

(OP)

Quote:

You do realize the original thread you referenced was 12 years ago when Delphi 7 was the most current Win32 option? Perhaps TEventLogger didn't exist then?

As for source: u_eventlog . Didn't find reference to the other.

Hi Glenn,

Believe it or not I'm having to use Delphi 7 and TEventLogger does exist. bigsmile It's what Xerox currently has available. Hoping they upgrade to Delphi 10 here soon considering I'm having to update up to 160 applications written in Delphi.

I did eventually find the "u_eventlog", but not the other.

Take care.


// ResonantEcho

RE: Delphi Service Example

(OP)

Quote:

Yes, code is a bit dated but still usable.
Nothing stops you from using TEventlogger :)

Going to give it a try. Thanks! ;)


// ResonantEcho

RE: Delphi Service Example

Nothing wrong with Delphi 7, it's probably the best option out there right now for Delphi given it's probably the most stable, least bloated platform that offers most all of the essentials you'd need. About the only thing that gets added is newer/different widgets/API calls - the API calls are pretty reproducible and the widgets only add value if they're valuable to you/the company. Of course, that's just one opinion out of many.

As far as the 160 applications, if they're all service-oriented, it might be useful to try to distill some things into some generic classes if you can. A lot of coding tends to involve a whole lot of disorganization and repeated inventing of wheels (for reasons both logical and unjustified) - I know I've been shocked at how abhorrent a lot of the code I've seen has been in my "professional" experiences simply for the lack of even a small amount of planning. Of course, the "logical" part is always pretty hard to solve, and I'd like to find a good solution to that just for my own stuff, much less code on the scope of a company.

How things are, I suppose...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close