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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the name of services running thr' VC++

Status
Not open for further replies.

madhosh

Programmer
Aug 10, 2001
14
Guys..
This is URGENT and will be a BIG HELP!!!!
I need to know if there is any API provided by MFC to retirve name of services running on a computer.
PLEASEEEEE RESPOND ..
THANKSSSSSS
 
Thanks for the reply..
I use

handle =OpenSCManager(NULL,NULL,SC_MANAGER_ENUMERATE_SERVICE);
err=GetLastError();
It returns a handle but gives error 997(ERROR_IO_PENDING)

if(handle){
ret= EnumServicesStatus(
handle, // handle to service control manager database
SERVICE_WIN32, // type of services to enumerate
SERVICE_ACTIVE, // state of services to enumerate
lpServices,
cbBufSize,
pcbBytesNeeded, // pointer to variable for bytes needed
lpServicesReturned,
// pointer to variable for number returned
lpResumeHandle // pointer to variable for next entry
);

Here it returns 0 and err code as 998 (ERR_NOACCESS)

Any idead where iam going wrong??
 
Who are you logged on as? Starting/Stopping/Querying Services usually needs PowerUser or Administrator access.

Chip H.
 
If you get a handle you don't need to check for an error. This is probably left over from some function which already dealt with the error. :) Hope that this helped! ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top