We help IT Professionals succeed at work.

Get service run-time parameters

bmatumbura asked
Medium Priority
Last Modified: 2010-04-07
Dear Experts,

I have developed a Windows NT Service in VB using the NTSVCOCX control from MSDN. I now need to develop an application that can communicate with the service and allow me to change the service's run-time parameters in real time as well as view various statistics on the service. The service is implemented as an in-process DLL and it exposes various properties and methods to the host application. How best can I implement this?

NOTE: The services processes data in a database. Users capture data into the database, and the service checks for new information in one of the tables. Once there is new information in the table, the service sends an SMS to the Admin via a GSM modem. If the database connection is dropped, the service also notifies the Admin. Now I need to develop an application that should communicate with the service and shows the service's realtime statistics and configurations.
Watch Question

Ouch, that might be hard to do, let me explain...

Services are multithreaded applications... with at least 2 threads.  VB doesn't natively support multi-threading (hince the need for the OCX control)

The OCX control doesn't provide the full functionality of a "native" service, just the bare-bones parts to make it "service-compliant".

By design, services do NOT expose properties and methods to the host application... instead you'd use the Service Control Manager to "talk" to the service.

Any serious communication between a host application and the service would be require a communication channel (shared memory, sockets, etc)

However, you might be able to communicate with your service via the shared database...  where you pass command to the service via a table entry, the service removes the commands from the table and performs that command, etc.   The service would just poll that table for new commands.

BTW:  This would be much easier with VB.Net (if that's an option).

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Since I have no options, let me do it the socket way so I can even run the application from another PC.

Yep, that's the "normal" way to communicate with a service.

One more thing... since your service (or perhaps a host program?) will be sending email (or SMS) it obviously needs access to the network.  Make sure the service is running under the context of a user that has network access.  By default, services are run with LocalSystem account which doesn't have valid credentials for networking.


Thanks Graye,

This would have caused me a lot of problems.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.