I am trying to code for AdHoc WiFi connection .For this i am using IDot11AdHocManager interface and to get the refrence for this i am using CoCreateInstance method.To obtain reference for IDot11AdHocManager i have written following code but it will give error or return NULL refrence. Please help me or correct my code
IDot11AdHocManager *pIAdHocMng = NULL ;
HRESULT hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_Dot11AdHocManager,NULL,CLSCTX_INPROC_HANDLER ,IID_IDot11AdHocManager ,(void**)pIAdHocMng);
if(hr == S_OK)
printf("CreateNetwork Method success due to following reason :\n %ld",hr) ;
else
printf("CreateNetwork Method fail due to following reason : %ld \n ",hr) ;
getch();
CoUninitialize() ;