Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start/stop IIS using C++

Status
Not open for further replies.

Pyramus

Programmer
Dec 19, 2001
237
0
0
GB
How can I start/stop IIS using C++?
 
I'd say use the Service Control Manager APIs:

hSCM = OpenSCManager( 0, 0, GENERIC_READ );
hService = OpenService(hSCM,
"Microsoft Internet Information Server",
SERVICE_STOP|SERVICE_START );
boolResult = ControlService(hService, SERVICE_CONTROL_STOP,
&structStatus );
/* or */
boolResult = ControlService(hService, SERVICE_CONTROL_START,
&structStatus );

This is just cut'n'paste from the API docs, but should get you on your way ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top