How to check whether windows file indexing is ON or OFF
问题 Is there an API in C that I can use to check whether file indexing is on or off? Code is appreciated. 回答1: WMI is a pain in C++, but the native Service API is pretty clean. SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT); if(hSCManager) { SC_HANDLE hService = OpenService(hSCManager, _T("ServiceNameGoesHere"), SERVICE_QUERY_STATUS); if(hService) { // service is installed SERVICE_STATUS ServiceStatus; if(ServiceQueryStatus(hService, &ServiceStatus)) { // service is running