Starting and Stopping Services 
Author Message
 Starting and Stopping Services

We have an application that has a routine that is run every night,
unattended

As part of this routine I would like to start and subsequently stop the
Remote Access Server Service as RAS isn't required to be running most of the
time

Can anyone give me some help as to how I can achieve this with API Calls?

I have found the api call given below but cannot find out what needs to be
passed as arguments
Declare Function StartService Lib "advapi32.dll" Alias "StartServiceA"
(ByVal hService As Long, ByVal dwNumServiceArgs As Long, ByVal
lpServiceArgVectors As Long) As Long

Any help gratefully received.
Please feel free to email me direct as well as posting a message back to the
group

Regards

Neil Jellis



Mon, 06 May 2002 03:00:00 GMT  
 Starting and Stopping Services
Hi,

Take a look at http://www.netfokus.dk/vbadmincode for an example.

--
Regards,

Garth Oatley
MVP Visual Basic
Please post/reply to the newsgroups


Quote:
> We have an application that has a routine that is run every night,
> unattended

> As part of this routine I would like to start and subsequently stop the
> Remote Access Server Service as RAS isn't required to be running most of
the
> time

> Can anyone give me some help as to how I can achieve this with API Calls?

> I have found the api call given below but cannot find out what needs to be
> passed as arguments
> Declare Function StartService Lib "advapi32.dll" Alias "StartServiceA"
> (ByVal hService As Long, ByVal dwNumServiceArgs As Long, ByVal
> lpServiceArgVectors As Long) As Long

> Any help gratefully received.
> Please feel free to email me direct as well as posting a message back to
the
> group

> Regards

> Neil Jellis



Mon, 06 May 2002 03:00:00 GMT  
 Starting and Stopping Services
Hi Garth,

Thanks for the pointer

I've looked at the code and one thing in particular is throwing me.
The routines need to be supplied with the strings of computername and
service

I presume that Computername is the name I see as the computer name on the
identification tab when I go into control panel\network (NT4)

Is the Service name the name held in the registry for the service that I am
trying to start and stop?

Any help gratefully received as this is getting into areas I haven't
explored before

Regards

Neil Jellis

Quote:

>Hi,

>Take a look at http://www.netfokus.dk/vbadmincode for an example.

>--
>Regards,

>Garth Oatley
>MVP Visual Basic
>Please post/reply to the newsgroups



Tue, 07 May 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Starting and Stopping Services

2. Starting and stopping Services from ASP or VBS

3. start and stop services

4. Start and Stop services in NT4 with VB5

5. Made a service, it starts, then stops

6. VB.Net Service Qustion: Detecting Program Start/Stop

7. To start and stop a service

8. Stopping/Starting Windows NT Services

9. Starting and stopping exsiting services

10. STOPPING/STARTING SERVICES FROM VB

11. what API starts/stops services?

12. Starting, monitoring and stopping services in NT 4

 

 
Powered by phpBB® Forum Software