I am able to solve this problem and will like to share my findings so as for the others to consider.
Samples provided in "VMWare Horizon 7 Session Enhancement SDK" are applications. An application when executed on a remote desktop, runs in the user context/session. So when we invoke VDPService_ServerInit( ) in the application, the SDK is able to recognize the user session (session associated with application) and therefore when we fetch the connection state using GetConnectionState() it provides us the correct status of the connection of the current user.
In contrast to above; a Windows Service does not run in user context. It is a system level daemon. So when VDPService_ServerInit( ) is executed in a service it is not able to identify the correct user session (may be it picks up the first available user session). Therefore in as Windows Service, the service should first enumerate all the users correctly connected or disconnected to the remote desktop using the windows API WTSEnumerateSessionsA(). Then it should use the session ID returned by this API and invoke VDPService_ServerInit2( ) along with the session ID to get the state of the connection.
So, the basic finding is the fact that VDP framework accepts the session IDs from the Window's APIs.