How to get the current state of cluster resource?
Posted by Karthick P.K on December 9, 2010
#include <windows.h> #include <ClusApi.h> #include <winbase.h> #include <iostream> using namespace std; #pragma comment(lib,"ClusApi.lib") #include <stdlib.h> void main() { HCLUSTER Clusterhandle=NULL; HRESOURCE ClusterRhandle=NULL; LPCWSTR lpszClusterName =NULL; WCHAR *lpszResourceName; CLUSTER_RESOURCE_STATE A = ClusterResourceStateUnknown; lpszResourceName =new WCHAR; wcout<<"enter the name of cluster resource:"; wcin.getline (lpszResourceName,256); Clusterhandle= OpenCluster(lpszClusterName); if (Clusterhandle!=NULL) { ClusterRhandle=OpenClusterResource(Clusterhandle,lpszResourceName); if (ClusterRhandle!=NULL) { printf("Got Cluster resource handle\n"); A= GetClusterResourceState(ClusterRhandle,NULL,NULL,NULL,NULL); if (A!=ClusterResourceStateUnknown) { printf("ClusterResourceState is:%d",A); } else { printf("ClusterResourceState is unknowm",GetLastError()); } } else { printf("Unable to get ClusterRhandle:%d",GetLastError()); } } else { printf ("unable to get handle to cluster",GetLastError()); } }
Top SQL Server blogs from MSSQLWIKI « MSSQLWIKI said
[…] How to get the current state of cluster resource? […]