Getting Started with the Collaboration API’s!




Guess what the first api you have to call is?


 


 


HRESULT WINAPI PeerCollabStartup(
WORD
wVersionRequested
);


 


http://windowssdk.msdn.microsoft.com/library/default.asp?url=/library/en-us/P2PSDK/p2p/peercollabstartup.asp


 


It’s our friend Mr. Startup!


The only version currently supported is 1.0 and it has to be called before any


PeerCollab* Api


 


Thankfully we define the version in the p2p.h file as


PEER_COLLAB_VERSION


Which is able to be passed in nicely!


 


 


Of course Mr. Startup would be lonely without Mr. Shutdown, so here he is.


 


HRESULT WINAPI PeerCollabShutdown(void);
http://windowssdk.msdn.microsoft.com/library/default.asp?url=/library/en-us/P2PSDK/p2p/peercollabshutdown.asp


 


Now, these don’t make a particularly interesting application as they don’t apparently do anything:) So lets see the first API that actually does something!


 


HRESULT WINAPI PeerCollabSignIn(
PEER_COLLAB_SIGNIN_OPTIONS
eSigninOptions
);


http://windowssdk.msdn.microsoft.com/library/en-us/P2PSDK/p2p/peercollabsignin.asp


 


This is the API that is used to sign in to the serverless presence system, it takes one option, the sign in options which determine which scope you sign into ( subnet vs Internet, or both) currently defined as:


PEER_PRESENCE_INTERNET


PEER_PRESENCE_NEAR_ME


PEER_PRESENCE_ALL


First, lets just start with “Near Me” which is classified as all people on the same network link


(all hosts on the same broadcast domain (ie behind a common router port) )


 


So far our simple console application should look something like this:


 


int __cdecl main(int argc, __in_ecount(argc) char *argv[])


{


HRESULT hr = S_OK;


hr =  PeerCollabStartup(PEER_COLLAB_VERSION);


if (SUCCEEDED(hr))


{


hr = PeerCollabSignin(PEER_PRESENCE_NEAR_ME);


(void)PeerCollabShutdown();


}


return 0;


}


 


Which while nicely formatted does nothing particularly interesting except sign us into the application. Next time we will actually do something useful!


 

Comments (0)