How to use Cluster API (clusapi.dll) in Delphi?


I'm currently trying to write a Cluster-Aware Service in Windows. Microsoft has provided us with clusapi.dll with all the necessary API to make a program cluster-aware.

The question is, how do I use it? Borland did not provide a unit which imports these APIs into Delphi. One of the procedure that I wish to use is GetClusterNodeState(). However, I do not know how to handle the result. I believe it is return as a DWORD, but not sure which value represent what state. MSDN Library is not very helpful towards Delphi programmers!...

Hope I get an answer soon...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi. I use "clusapi.h" and "clusapi.lib" from VC++ but you can import functions from clusapi.dll. Code for checking node state can be like the following:

HCLUSTER hCluster = OpenCluster( L"<ClusterName>" );
HNODE hNode = OpenClusterNode( hCluster, L"<NodeName>" );
CLUSTER_NODE_STATE eState = GetClusterNodeState( hNode );
CloseClusterNode( hNode );
CloseCluster( hCluster );

<ClusterName> - name of the machine where a node is installed.
<NodeName> - name of the machine where a node is installed; can be different from <ClusterNode>

eState can be one of the following values:

Sorry I don't know how exectly it will be in Delphi but I am sure you can figure it out ;-)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.