HrGetOneProp fails

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
 
G

Gabi Fruhner

Hi Dmitry,

error code is [MAPI_E_NOT_FOUND(8004010F)].

In both Dlls its the same code and in JumpIn Dll (don't know the english
word) code works fine but in Class Dll HrGetOneProp return this error.

Thanks

Gabi
 
D

Dmitry Streblechenko \(MVP\)

Are you sure you are not compiling in Unicode so that PR_PROFILE_NAME
becomes PR_PROFILE_NAME_W?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


Gabi Fruhner said:
Hi Dmitry,

error code is [MAPI_E_NOT_FOUND(8004010F)].

In both Dlls its the same code and in JumpIn Dll (don't know the english
word) code works fine but in Class Dll HrGetOneProp return this error.

Thanks

Gabi


Dmitry Streblechenko (MVP) said:
What is the error code returned by HrGetOneProp?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
lpMAPISession->OpenProfileSection((LPMAPIUID)pbGlobalProfileSectionGuid,NULL
 
G

Gabi Fruhner

Thanks Dmitry,

that was it


Dmitry Streblechenko (MVP) said:
Are you sure you are not compiling in Unicode so that PR_PROFILE_NAME
becomes PR_PROFILE_NAME_W?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


Gabi Fruhner said:
Hi Dmitry,

error code is [MAPI_E_NOT_FOUND(8004010F)].

In both Dlls its the same code and in JumpIn Dll (don't know the english
word) code works fine but in Class Dll HrGetOneProp return this error.

Thanks

Gabi


Dmitry Streblechenko (MVP) said:
What is the error code returned by HrGetOneProp?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top