G
Gabi Fruhner
Hi,
I've written a C++ Dll to get and set body of a hidden message.
I pass a Outlook.MAPIFolder to C++
STDMETHODIMP CTools::GetAdminMessage(/*[in]*/ VARIANT pFolder, /*[in]*/ long
CanCreate, /*[in]*/ BSTR* Subject, /*[out,retval]*/ BSTR* result)
{
LPUNKNOWN lpUnknown;
LPMAPIFOLDER lpFolder;
...
...
lpUnknown = getMapiObject(pFolder.pdispVal);
if (!lpUnknown) return E_NOINTERFACE;
// OL 2000 return
// OL 20020 SUCCEEDED
lpUnknown->QueryInterface(IID_IMAPIFolder, (LPVOID*) &lpFolder);
if (!lpFolder) return E_NOINTERFACE;
hr = lpFolder->GetContentsTable(MAPI_ASSOCIATED, &lpTable);
...
...
}
// Example from Internet
LPUNKNOWN CTools::getMapiObject(LPDISPATCH disp)
{
DISPID rgDispId;
DISPPARAMS dispparams = {NULL, NULL, 0, 0};
VARIANT vaResult;
LPOLESTR pName = L"MAPIOBJECT";
VariantInit(&vaResult);
if
(SUCCEEDED(disp->GetIDsOfNames(IID_NULL,&pName,1,LOCALE_SYSTEM_DEFAULT,&rgDi
spId)))
if (SUCCEEDED(disp->Invoke(rgDispId, IID_NULL, 0, DISPATCH_PROPERTYGET,
&dispparams, &vaResult, NULL, NULL)))
if (vaResult.vt == VT_UNKNOWN)
{
return vaResult.punkVal;
}
return NULL;
}
and it works fine in OL 2002, but in OL 2000 'getMapiObject' fails.
I think it is, because Outlook.MAPIFolder.MAPIOBJECT is not supported in OL
2000.
Is there another way to pass a Outlook.MAPIFolder or is there an error in my
code ?
Some code would be helpful because this is my first C++ Dll and the smallest
problem is a big problem for me.
Thanks
Gabi
I've written a C++ Dll to get and set body of a hidden message.
I pass a Outlook.MAPIFolder to C++
STDMETHODIMP CTools::GetAdminMessage(/*[in]*/ VARIANT pFolder, /*[in]*/ long
CanCreate, /*[in]*/ BSTR* Subject, /*[out,retval]*/ BSTR* result)
{
LPUNKNOWN lpUnknown;
LPMAPIFOLDER lpFolder;
...
...
lpUnknown = getMapiObject(pFolder.pdispVal);
if (!lpUnknown) return E_NOINTERFACE;
// OL 2000 return
// OL 20020 SUCCEEDED
lpUnknown->QueryInterface(IID_IMAPIFolder, (LPVOID*) &lpFolder);
if (!lpFolder) return E_NOINTERFACE;
hr = lpFolder->GetContentsTable(MAPI_ASSOCIATED, &lpTable);
...
...
}
// Example from Internet
LPUNKNOWN CTools::getMapiObject(LPDISPATCH disp)
{
DISPID rgDispId;
DISPPARAMS dispparams = {NULL, NULL, 0, 0};
VARIANT vaResult;
LPOLESTR pName = L"MAPIOBJECT";
VariantInit(&vaResult);
if
(SUCCEEDED(disp->GetIDsOfNames(IID_NULL,&pName,1,LOCALE_SYSTEM_DEFAULT,&rgDi
spId)))
if (SUCCEEDED(disp->Invoke(rgDispId, IID_NULL, 0, DISPATCH_PROPERTYGET,
&dispparams, &vaResult, NULL, NULL)))
if (vaResult.vt == VT_UNKNOWN)
{
return vaResult.punkVal;
}
return NULL;
}
and it works fine in OL 2002, but in OL 2000 'getMapiObject' fails.
I think it is, because Outlook.MAPIFolder.MAPIOBJECT is not supported in OL
2000.
Is there another way to pass a Outlook.MAPIFolder or is there an error in my
code ?
Some code would be helpful because this is my first C++ Dll and the smallest
problem is a big problem for me.
Thanks
Gabi