Don't know about the headers - I don't use VC++. Did you try to create new
headers using the Outlook 2007 type library?
OutlookSpy always uses late binding when retrieving that property - call
IDispatch::GetIDsOfNames("MAPIOBJECT", ...) then IDispatch::Invoke().
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"pete_42" wrote in message
ups.com...
Took some time, but I got some news:
1. pMailItem-Save();
Works most of the time. (Currently I don't worry about RARE crashes)
2. pMailItem-get_MAPIOBJECT(...);
Works most of the time, about always yields a NULL pointer.
3. pMailItem-get_Class(...)
Works most of the time and yields 43.
= So the pMailItem Pointer should be correct.
If I compile my DLL in debug mode (Previously I used release mode for
an easier deployment on the other PC), I get an error messagesaying
the ESP wasn't properly restored, probably because of differing calling
coventions. So I guess that my include files (Generated from Outlook
2000) are bad.
Quoting from msoutl9.tlh:
__declspec(property(get=GetMAPIOBJECT))
IUnknownPtr MAPIOBJECT;
and
virtual HRESULT __stdcall get_MAPIOBJECT (
IUnknown * * MAPIOBJECT ) = 0;
Quoting from msoutl9.tli:
#pragma implementation_key(564)
inline IUnknownPtr Outlook::_MailItem::GetMAPIOBJECT ( ) {
IUnknown * _result;
HRESULT _hr = get_MAPIOBJECT(&_result);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return IUnknownPtr(_result, false);
}
But this yields new questions:
- Does GetMAPIOBJECT really call get_MAPIOBJECT? If so, why don't I get
a crash for the latter and why does Microsoft recommend no to use
get_MAPIOBJECT?
- Is the include bad? And how? Is _stdcall or HRESULT or IUnknown
defined wrong by some include?
- Is there another way to call the function? Some generic
Invoke/Message/Whatever?
- Which call do you perform in OutlookSpy when I doubleclick the
MAPIOBJECT item in the CurrentItem() View?
Thanks.
Dmitry Streblechenko wrote:
What happens when you run your code under the debugger? Did you set
"break
on exception" for all exceptions in Debug | Exceptions dialog?