G
Gabi Fruhner
Hi,
I don't know why HrGetOneProp works here
EXP_LONG GetCurrentProfileName (char* result)
{
HRESULT hr = 0;
int hRes = 0;
LPMAPISESSION lpMAPISession = NULL;
LPPROFSECT lpProfileSection = NULL;
LPSPropValue prop = NULL;
#define MAPI_NO_COINIT 0x08
MAPIINIT_0 MAPIINIT = { 0, MAPI_MULTITHREAD_NOTIFICATIONS |
MAPI_NO_COINIT };
hRes = MAPIInitialize(&MAPIINIT);
if (hRes == MAPI_E_UNKNOWN_FLAGS)
{
MAPIINIT.ulFlags &= ~MAPI_NO_COINIT;
hRes = MAPIInitialize(&MAPIINIT);
}
if (FAILED(hRes))
{
hRes = MAPIInitialize (NULL);
if (FAILED(hRes)) return 0;
}
hRes = MAPILogonEx(0,NULL,NULL,MAPI_EXTENDED,&lpMAPISession);
if(FAILED(hRes)) goto ret;
hRes =
lpMAPISession->OpenProfileSection((LPMAPIUID)pbGlobalProfileSectionGuid,NULL
,MAPI_MODIFY ,&lpProfileSection);
if(FAILED(hRes)) goto ret;
hRes = HrGetOneProp(lpProfileSection,PR_PROFILE_NAME,&prop);
if(FAILED(hRes)) goto ret;
...
...
very fine but in a Class Dll
STDMETHODIMP CTools::Init()
{
HRESULT hr = 0;
....
....
the same code fails at HrGetOneProp/GetProps.
Is there any idea.
Thanks
Gabi
I don't know why HrGetOneProp works here
EXP_LONG GetCurrentProfileName (char* result)
{
HRESULT hr = 0;
int hRes = 0;
LPMAPISESSION lpMAPISession = NULL;
LPPROFSECT lpProfileSection = NULL;
LPSPropValue prop = NULL;
#define MAPI_NO_COINIT 0x08
MAPIINIT_0 MAPIINIT = { 0, MAPI_MULTITHREAD_NOTIFICATIONS |
MAPI_NO_COINIT };
hRes = MAPIInitialize(&MAPIINIT);
if (hRes == MAPI_E_UNKNOWN_FLAGS)
{
MAPIINIT.ulFlags &= ~MAPI_NO_COINIT;
hRes = MAPIInitialize(&MAPIINIT);
}
if (FAILED(hRes))
{
hRes = MAPIInitialize (NULL);
if (FAILED(hRes)) return 0;
}
hRes = MAPILogonEx(0,NULL,NULL,MAPI_EXTENDED,&lpMAPISession);
if(FAILED(hRes)) goto ret;
hRes =
lpMAPISession->OpenProfileSection((LPMAPIUID)pbGlobalProfileSectionGuid,NULL
,MAPI_MODIFY ,&lpProfileSection);
if(FAILED(hRes)) goto ret;
hRes = HrGetOneProp(lpProfileSection,PR_PROFILE_NAME,&prop);
if(FAILED(hRes)) goto ret;
...
...
very fine but in a Class Dll
STDMETHODIMP CTools::Init()
{
HRESULT hr = 0;
....
....
the same code fails at HrGetOneProp/GetProps.
Is there any idea.
Thanks
Gabi