Current Profilename

K

Karl Schmidt

Hi NG,

have an external Outlook App which uses MAPI functions of a C++ DLL.
I have created this C++ DLL with samples from Internet (I am only a poor
VB programmer and do know NOTHING about C++ - what a luck that code
compile and DLL run) and DLL is nearly complete.
Because I must read some registry settings which are stored under
profilename, I have to determine current profilename that Outlook uses.

C++ DLL is initialized after Outlook initialisation

'**VB Code
Set OLApp = CreateObject("Outlook.Application")

Set myObj = New myC++DLL.myC++Class
myObj.Init
'**End VB Code


and my question is if there is someone, who can help a poor VB
programmer and can complete C++ Init function, so that this function can
return 'Current Profilename'


'**C++ Code
STDMETHODIMP CmyC++Class::Init()
{
#define MAPI_NO_COINIT 0x08
MAPIINIT_0 MAPIINIT = { 0, MAPI_MULTITHREAD_NOTIFICATIONS |
MAPI_NO_COINIT };
HRESULT hr = MAPIInitialize(&MAPIINIT);
if(hr == MAPI_E_UNKNOWN_FLAGS)
{
MAPIINIT.ulFlags &= ~MAPI_NO_COINIT;
hr = MAPIInitialize(&MAPIINIT);
}
if (FAILED(hr)) hr = MAPIInitialize (NULL);
return hr;
}
'**End C++ Code


The only thing I found for this is a post from Dmitry Streblechenko

1. IMAPISession::OpenProfileSection() -> get IProfSect
2. HrGetOneProp(ProfSect, PR_PROFILE_NAME, ...)

but my C++ is too bad to translate this to a working C++ code.


I know getting profilename is also possible with CDOSession.Name, but
because I don't need CDO anywhere else, I want to try it this way.


Thank you

Karl
 

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

Similar Threads


Top