Windows Vista Forums

Creating a Windows Service

  1. #1


    Harry Bellafonte Guest

    Creating a Windows Service

    Hi

    I have created a Windows Sesrvice through a reg file. This is the
    content of the reg file:

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\User Admin
    Agent]
    "Description"="Starts the User Process."

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\User Admin Agent
    \Parameters]
    "Application"="C:\\RunAgent\\UserProcess.cmd"

    The service is created perfectly. What I want to do is the following.
    When I stop the service I would like to kill/shutdown a process that
    is initiated when the service is started. I have asked around how to
    do it. I found out that it is possible but I have to add dependencies
    when creating the Windows Service.
    How can I create a dependency at the creation of the Windows Service?
    And how can I make sure that this dependency is to shut down a
    process(in this case java.exe)?

    Any help will be appreciated.

    Regards

      My System SpecsSystem Spec

  2. #2


    Duy Lam Guest

    Re: Creating a Windows Service


    Why don't you use the tool installutil.exe in .net tools
    (http://msdn.microsoft.com/en-us/libr...92(VS.80).aspx) to
    register service instead of doing manually?

    I found these steps on net may help you.
    (http://kb.adobe.com/selfservice/view...nalId=kb400960)

    The following steps need to be performed in order to create a dependency.

    1. Backup your current registry settings.
    2. Run 'regedit' to open your registry.
    3. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
    and locate the service that you need to set a dependency for.
    4. Open the 'DependOnService' key on the right side. If the selected
    service does not have a 'DependOnService' key, then create one by
    right-clicking and selecting New > Multi-String Value.
    5. In the value field, enter the names of all services that the
    current service will depend on. Each service name must be entered
    properly and on a separate line.
    6. Click OK, close your registry and restart your machine.



    Harry Bellafonte wrote:

    > Hi
    >
    > I have created a Windows Sesrvice through a reg file. This is the
    > content of the reg file:
    >
    > Windows Registry Editor Version 5.00
    >
    > [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\User Admin
    > Agent]
    > "Description"="Starts the User Process."
    >
    > [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\User Admin Agent
    > \Parameters]
    > "Application"="C:\\RunAgent\\UserProcess.cmd"
    >
    > The service is created perfectly. What I want to do is the following.
    > When I stop the service I would like to kill/shutdown a process that
    > is initiated when the service is started. I have asked around how to
    > do it. I found out that it is possible but I have to add dependencies
    > when creating the Windows Service.
    > How can I create a dependency at the creation of the Windows Service?
    > And how can I make sure that this dependency is to shut down a
    > process(in this case java.exe)?
    >
    > Any help will be appreciated.
    >
    > Regards
    --
    Thanks,
    Duy Lam

      My System SpecsSystem Spec

Creating a Windows Service

Similar Threads
Thread Forum
800A01AD error when creating Schedule.Service object
Hi I'm terying to programmatically determine information about scheduled task running in a Windows Server 2003 SP1 machine. I've created a...
VB Script
re: Creating an Installer for a Service and an Application
Hi Nick, I can't tell when you posted this, so it may be far too late to help you with this issue. Also, I'm not sure exactly how this works with...
.NET General
Is Windows Mail supporting Hotmail as a free service or is it a paid service
-- Ishwar Prasad 39/8 Graham Street Port Melbourne, VIC 3207 Australia Tel: +613 96454124 Mob: +61 423663694 SKYPE: xquiseete
Vista mail
Creating a HTTP Push type service using a single channel
Hi, I've got the following requirements for a WCF service... * a push type service, ie a server which can send notifications to clients. *...
Indigo
The Windows Firewall service terminated with service-specific erro
Been getting this error, and nobody seems to know how to fix it. Below are varoius queries... SERVICE_NAME: mpssvc TYPE : 20 ...
Vista security
Creating a new service using WIN32_service
Does anyone know of any articles that describe how to create a new service using WIN32_Service? There are plently of examples of how to manipulate...
PowerShell
How WCF service hosted by Windows Service to raise the windows form client side's events?
I want to write WCF service that have some events raise on the win-form client side (when client is running). However, I read many samples all are...
Indigo