Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


service applications has 0 (zero) paramcount despite being started with one or more parameters

Posted on 2003-03-18
Medium Priority
Last Modified: 2011-05-29
I have a small service application. I am trying to enable logging by starting the service with a particular parameter.

I find that no matter how I start the service, the paramcount is always zero. Despite this I can always get a value for paramstr(0).

Can anyone help.

Example of code....

In the ServiceStart event ...

  LogMessage('paramstr(0): ' + paramstr(0), EVENTLOG_INFORMATION_TYPE, 0);
  LogMessage('paramstr(1): ' + paramstr(1), EVENTLOG_INFORMATION_TYPE, 0);
  LogMessage('ParamCount: ' + IntToStr(paramcount), EVENTLOG_INFORMATION_TYPE, 0);

and when the service is started with "loglevel:3" as a start parameter (using the services properties dialog ....) this produces;

  paramstr(0) - <path>'\myservice.exe
  paramstr(1) - nothing, empty event entry
  paramcount - 0
Question by:naleo
  • 2

Author Comment

ID: 8163922
Found the problem!!!

It appears that during the TService.Create event, paramcount is zero, however param[0] will give the name and path of the service.exe.

In the TService.Start event, ParamCount and Param[index] work sort of as expected .... with the exception that param[0] is the name of the service (not the .exe) ... ie: its no good for getting the path of the exe.

Hope this helps someone else....

Author Comment

ID: 8163946
requesting a delete for this question .....

Accepted Solution

Computer101 earned 0 total points
ID: 8164028
Points refunded and placed in PAQ

E-E Admin

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question