#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()); } }
Posts Tagged ‘OpenCluster’
How to get the current state of cluster resource?
Posted by Karthick P.K on December 9, 2010
Posted in Programming, SQL Server Cluster | Tagged: GetClusterResourceState, OpenCluster, OpenClusterResource | 1 Comment »