问题
I'm trying to improve my Lotus Notes client code:
Working:
#import "...\IBM\Lotus\Notes\notes32.tlb" no_dual_interfaces raw_native_types
CComPtr<IDispatch> session_dispatch;
if(FAILED(session_dispatch.CoCreateInstance(_T("Notes.NotesSession"))))
...
NOTESSESSION *session = static_cast<NOTESSESSION *>(*&session_dispatch);
This gives me a valid NOTESSESSION
object that is aware that it needs to go through IDispatch
to actually invoke methods.
I found some example code on the net, which looks a lot saner and assumes a later Notes version:
#import "...\IBM\Lotus\Notes\domobj.tlb" raw_interfaces_only raw_native_types
CComPtr<Domino::ISession> notes;
if(FAILED(notes.CoCreateInstance(_T("Notes.NotesSession"))))
...
However that returns E_NOINTERFACE
. As others claim to have similar code working, I wonder what may be going on here, and humbly ask whether anyone else has working code to instantiate a Session object and get a working interface pointer.
回答1:
With domobj.tlb, you should use "Domino.NotesSession" rather than "Notes.NotesSession".
来源:https://stackoverflow.com/questions/8213618/lotus-notes-automation-notes-notessession-doesnt-implement-dominoisession