?
Solved

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

Posted on 2003-03-18
3
Medium Priority
?
390 Views
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
0
Comment
Question by:naleo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:naleo
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....
0
 

Author Comment

by:naleo
ID: 8163946
requesting a delete for this question .....
0
 
LVL 1

Accepted Solution

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

Computer101
E-E Admin
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

770 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