NT service


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: NT service

  1. #1
    Patrick Martineau Guest

    NT service


    I'm want to create an NT service in VB6 WITHOUT using the ntsvc.ocx I've tried
    it and that didn't do it for me: the service will not start on it's own after
    a reboot and it doesn't matter if it's the "LocalSystem" user or a real user.
    The service will start without any problem though when using the SCM. I wanted
    see if using the real NT service functions instead of the OCX would solve
    the problem.

    So I'm using the code found in the MSDN library. The code is for VB5, but
    with a few modif I can make it work on VB6. However, when I start the service
    in the SCM (or at the login prompt), I always get erro #1063 (The service
    process could not connect to the service controller.) After looking in the
    VB newsgroups, I found out that VB6 has a problem with the VB5 code and there
    is a article discussing that on the microsoft site.

    Has anyone seen the article or know the solution to the problem?

    Thanks

  2. #2
    L.J. Johnson Guest

    Re: NT service

    Patrick,

    > I'm want to create an NT service in VB6 WITHOUT using the ntsvc.ocx I've

    tried
    > it and that didn't do it for me: the service will not start on it's own

    after
    > a reboot and it doesn't matter if it's the "LocalSystem" user or a real

    user.
    > The service will start without any problem though when using the SCM. I

    wanted
    > see if using the real NT service functions instead of the OCX would solve
    > the problem.
    >
    > So I'm using the code found in the MSDN library. The code is for VB5, but
    > with a few modif I can make it work on VB6. However, when I start the

    service
    > in the SCM (or at the login prompt), I always get erro #1063 (The service
    > process could not connect to the service controller.) After looking in the
    > VB newsgroups, I found out that VB6 has a problem with the VB5 code and

    there
    > is a article discussing that on the microsoft site.


    No, sorry, I reached the limits of my patience when VB 6.0 broke that (and a
    number of other pieces) of code. Ggggrrrr. I switch to Desaware's Services
    Toolkit myself..

    I haven't seen that *particular* problem (won't start on it's on). From the
    SCM (I have to ask), are you sure that its set to Automatic? Are there any
    dependencies (i.e., won't run unless another service is running)? If so, are
    they listed in the dependenies of the service? Are you getting any errors?
    If a timeout error, have you tried increasing the "timeout" for the service?
    Some do exceed the timeout, particularly on startup when a lot of other
    things are also trying to startup (i.e., reduced CPU cycles available).

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.inquiry.com>




  3. #3
    L.J. Johnson Guest

    Re: NT service

    Patrick,

    > I'm want to create an NT service in VB6 WITHOUT using the ntsvc.ocx I've

    tried
    > it and that didn't do it for me: the service will not start on it's own

    after
    > a reboot and it doesn't matter if it's the "LocalSystem" user or a real

    user.
    > The service will start without any problem though when using the SCM. I

    wanted
    > see if using the real NT service functions instead of the OCX would solve
    > the problem.
    >
    > So I'm using the code found in the MSDN library. The code is for VB5, but
    > with a few modif I can make it work on VB6. However, when I start the

    service
    > in the SCM (or at the login prompt), I always get erro #1063 (The service
    > process could not connect to the service controller.) After looking in the
    > VB newsgroups, I found out that VB6 has a problem with the VB5 code and

    there
    > is a article discussing that on the microsoft site.


    No, sorry, I reached the limits of my patience when VB 6.0 broke that (and a
    number of other pieces) of code. Ggggrrrr. I switch to Desaware's Services
    Toolkit myself..

    I haven't seen that *particular* problem (won't start on it's on). From the
    SCM (I have to ask), are you sure that its set to Automatic? Are there any
    dependencies (i.e., won't run unless another service is running)? If so, are
    they listed in the dependenies of the service? Are you getting any errors?
    If a timeout error, have you tried increasing the "timeout" for the service?
    Some do exceed the timeout, particularly on startup when a lot of other
    things are also trying to startup (i.e., reduced CPU cycles available).

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.inquiry.com>




  4. #4
    Patrick Martineau Guest

    Re: NT service


    "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote:
    >Patrick,
    >
    >> I'm want to create an NT service in VB6 WITHOUT using the ntsvc.ocx I've

    >tried
    >> it and that didn't do it for me: the service will not start on it's own

    >after
    >> a reboot and it doesn't matter if it's the "LocalSystem" user or a real

    >user.
    >> The service will start without any problem though when using the SCM.

    I
    >wanted
    >> see if using the real NT service functions instead of the OCX would solve
    >> the problem.
    >>
    >> So I'm using the code found in the MSDN library. The code is for VB5,

    but
    >> with a few modif I can make it work on VB6. However, when I start the

    >service
    >> in the SCM (or at the login prompt), I always get erro #1063 (The service
    >> process could not connect to the service controller.) After looking in

    the
    >> VB newsgroups, I found out that VB6 has a problem with the VB5 code and

    >there
    >> is a article discussing that on the microsoft site.

    >
    >No, sorry, I reached the limits of my patience when VB 6.0 broke that (and

    a
    >number of other pieces) of code. Ggggrrrr. I switch to Desaware's Services
    >Toolkit myself..
    >
    >I haven't seen that *particular* problem (won't start on it's on). From

    the
    >SCM (I have to ask), are you sure that its set to Automatic? Are there any
    >dependencies (i.e., won't run unless another service is running)? If so,

    are
    >they listed in the dependenies of the service? Are you getting any errors?
    >If a timeout error, have you tried increasing the "timeout" for the service?
    >Some do exceed the timeout, particularly on startup when a lot of other
    >things are also trying to startup (i.e., reduced CPU cycles available).
    >
    >--
    >L.J. Johnson, Slightly Tilted Software
    >Microsoft MVP (Visual Basic)
    >LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    ><http://www.SlightlyTiltedSoftware.com>
    >Ask The NT Pro at <http://www.inquiry.com>
    >
    >
    >


    Yes, the service is set to "Automatic". The weird thing is that if I login
    quickly after a reboot (before the service tries to start on its own), the
    service starts without any problem. If I reboot and wait a while in the login
    screen (let all the services start on their own before I login), the service
    doesn't start. Using the "LocalSystem" account or a specific account doesn't
    change the behavior. The service doesn't belong to a group so it should be
    started after all the services that belong to a group (that's according to
    Microsoft docs). As fas as dependencies, the only thing the service needs
    is access to a directory and be able to create my own objects, one of which
    is to establish a connection with a SQL database (the object is registred
    on MTS and then installed on the client). Maybe that's the problem? The connection
    can't be done unless a user is logged in?

    Thanks for your help.

  5. #5
    Patrick Martineau Guest

    Re: NT service


    "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote:
    >Patrick,
    >
    >> I'm want to create an NT service in VB6 WITHOUT using the ntsvc.ocx I've

    >tried
    >> it and that didn't do it for me: the service will not start on it's own

    >after
    >> a reboot and it doesn't matter if it's the "LocalSystem" user or a real

    >user.
    >> The service will start without any problem though when using the SCM.

    I
    >wanted
    >> see if using the real NT service functions instead of the OCX would solve
    >> the problem.
    >>
    >> So I'm using the code found in the MSDN library. The code is for VB5,

    but
    >> with a few modif I can make it work on VB6. However, when I start the

    >service
    >> in the SCM (or at the login prompt), I always get erro #1063 (The service
    >> process could not connect to the service controller.) After looking in

    the
    >> VB newsgroups, I found out that VB6 has a problem with the VB5 code and

    >there
    >> is a article discussing that on the microsoft site.

    >
    >No, sorry, I reached the limits of my patience when VB 6.0 broke that (and

    a
    >number of other pieces) of code. Ggggrrrr. I switch to Desaware's Services
    >Toolkit myself..
    >
    >I haven't seen that *particular* problem (won't start on it's on). From

    the
    >SCM (I have to ask), are you sure that its set to Automatic? Are there any
    >dependencies (i.e., won't run unless another service is running)? If so,

    are
    >they listed in the dependenies of the service? Are you getting any errors?
    >If a timeout error, have you tried increasing the "timeout" for the service?
    >Some do exceed the timeout, particularly on startup when a lot of other
    >things are also trying to startup (i.e., reduced CPU cycles available).
    >
    >--
    >L.J. Johnson, Slightly Tilted Software
    >Microsoft MVP (Visual Basic)
    >LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    ><http://www.SlightlyTiltedSoftware.com>
    >Ask The NT Pro at <http://www.inquiry.com>
    >
    >
    >


    Yes, the service is set to "Automatic". The weird thing is that if I login
    quickly after a reboot (before the service tries to start on its own), the
    service starts without any problem. If I reboot and wait a while in the login
    screen (let all the services start on their own before I login), the service
    doesn't start. Using the "LocalSystem" account or a specific account doesn't
    change the behavior. The service doesn't belong to a group so it should be
    started after all the services that belong to a group (that's according to
    Microsoft docs). As fas as dependencies, the only thing the service needs
    is access to a directory and be able to create my own objects, one of which
    is to establish a connection with a SQL database (the object is registred
    on MTS and then installed on the client). Maybe that's the problem? The connection
    can't be done unless a user is logged in?

    Thanks for your help.

  6. #6
    L.J. Johnson Guest

    Re: NT service

    Patrick,

    > Yes, the service is set to "Automatic". The weird thing is that if I login
    > quickly after a reboot (before the service tries to start on its own), the
    > service starts without any problem. If I reboot and wait a while in the

    login
    > screen (let all the services start on their own before I login), the

    service
    > doesn't start. Using the "LocalSystem" account or a specific account

    doesn't
    > change the behavior. The service doesn't belong to a group so it should be
    > started after all the services that belong to a group (that's according to
    > Microsoft docs). As fast as dependencies, the only thing the service needs
    > is access to a directory and be able to create my own objects, one of

    which
    > is to establish a connection with a SQL database (the object is registered
    > on MTS and then installed on the client). Maybe that's the problem? The

    connection
    > can't be done unless a user is logged in?


    Wouldn't that mean the service (via one of the objects it creates) has a
    dependency on the SQL database being started? I know with SQL Server,
    depending upon how fast the machine is and how many other things are being
    loaded, the SQL service can take a while to finish initializing.

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.inquiry.com>



  7. #7
    L.J. Johnson Guest

    Re: NT service

    Patrick,

    > Yes, the service is set to "Automatic". The weird thing is that if I login
    > quickly after a reboot (before the service tries to start on its own), the
    > service starts without any problem. If I reboot and wait a while in the

    login
    > screen (let all the services start on their own before I login), the

    service
    > doesn't start. Using the "LocalSystem" account or a specific account

    doesn't
    > change the behavior. The service doesn't belong to a group so it should be
    > started after all the services that belong to a group (that's according to
    > Microsoft docs). As fast as dependencies, the only thing the service needs
    > is access to a directory and be able to create my own objects, one of

    which
    > is to establish a connection with a SQL database (the object is registered
    > on MTS and then installed on the client). Maybe that's the problem? The

    connection
    > can't be done unless a user is logged in?


    Wouldn't that mean the service (via one of the objects it creates) has a
    dependency on the SQL database being started? I know with SQL Server,
    depending upon how fast the machine is and how many other things are being
    loaded, the SQL service can take a while to finish initializing.

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.inquiry.com>



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center