If you are using MAPI try this. You should have a profile name supplied. HRESULT GetServerName(LPSTR rszProfileName) { HRESULT hRes = S_OK; LPPROFADMIN pAdminProfiles = NULL; LPSERVICEADMIN pSvcAdmin = NULL; LPPROFSECT pGlobalProfSect = NULL; LPSPropValue pProps = NULL; // Get a Profile admin object if ( FAILED ( hRes = MAPIAdminProfiles ( 0L, &pAdminProfiles ) ) ) return hRes ; // Get a ServiceAdmin object if ( FAILED ( hRes = pAdminProfiles -> AdminServices ( rszProfileName, NULL, 0L, // Your app's window handle 0L, &pSvcAdmin ) ) ) return hRes ; // Get the Global Profile Section by calling // IServiceAdmin::OpenProfileSection use pbGlobalProfileSectionGuid // defined in EDKMDB.H as the entry ID to request // The default return is an IProfSect interface. if ( FAILED ( hRes = pSvcAdmin -> OpenProfileSection ( (LPMAPIUID)pbGlobalProfileSectionGuid, NULL, 0L, &pGlobalProfSect ) ) ) return hRes ; // Call HrGetOneProp to get PR_PROFILE_HOME_SERVER if ( FAILED ( hRes = HrGetOneProp ( pGlobalProfSect, PR_PROFILE_HOME_SERVER, &pProps ) ) ) return hRes ; CString m_strServerName = pProps -> Value.lpszA ; if ( NULL != pAdminProfiles ) pAdminProfiles -> Release (); if ( NULL != pSvcAdmin ) pSvcAdmin -> Release ( ); if ( NULL != pGlobalProfSect ) pGlobalProfSect -> Release ( ); if ( NULL != pProps ) MAPIFreeBuffer ( &pProps ); pSvcAdmin = NULL; pGlobalProfSect = NULL; pProps = NULL; pAdminProfiles = NULL; // Return the HRESULT to the calling function return hRes; }
The above code might have some variables not declared. Pls check it out before using. Muthukumar.V Home: WWW.CoderSource.Net
M
Muthukumar
@Muthukumar
Posts
-
mail server -
Mapping of events -MFC InternalsCheck out this place. This might probably give some ideas. http://www.codersource.net/mfc\_tutorial\_Part2.html Thanks Muthu Muthukumar.V
-
help!~Who can show a code of simulate network server?U can check this link. http://www.codersource.net/winsock\_tutorial\_server\_event\_model.html May find this useful. Thanks