I've seen a lot of systems where the combinations of mapi32.dll,
mapi32x.dll, and mapistub.dll are not the correct DLLs.
I think I've figured out a pretty sure fire method to make sure that
as long as Outlook can run, my calls to MAPIFreeBuffer should also
work. So if this works, I'm not so worried. Here is what I'm doing
in my COM add-in now, in my "OnConnect" event:
h = GetModuleHandle("msmapi32.dll");
GetModuleFileName(h,filename,...);
l = LoadLibrary(filename);
pMAPIFreeBuffer = GetProcAddress(l,"MAPIFreeBuffer");
I've removed a lot of code, but I think the above code is pretty clear
as to what I'm doing. I added the call to LoadLibrary(), instead of
using handle from GetModuleHandle(), to make sure the handle stays
valid until I call FreeLibrary().
It seems like this will ensure that I use the same copy of DLL that
Outlook is using, so my COM add-in should have the least chance of
having DLL issues. As long as the function name doesn't change, or
get an "@4" or something added to it in the future.
Thanks again. I got most of the ideas for the above method from
reading other messages posted by you, except I decided this route
should work better than the FGetModulePath route on MSDN, and it
should work because with the COM add-in I know Outlook is loaded.
"Dmitry Streblechenko" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> No, MAPIFreeBuffer is MAPIFreeBuffer, why do you want to have it exposed
> though OOM? What's wrong with loading mapi32.dll (dynamically or
> statically)?
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool