Problem:
MAPILogon returns 3 when used with the COBOL Multi Threaded runtime.
It may work sometimes but if invokes are performed to any COM object before the MAPILogon call then you will always get a -3 returned.
Resolution:
You need to perform an:-
invoke olesup "singleThread"
so that the COBOL runtime initialized COM with CoInitializeEx(0,COINIT_APARTMENTTHREADED).
If this call is not made then the runtime will initialize COM with CoInitializeEx(0,COINIT_MULTITHREADED).
Microsoft's MAPI api is not compatible with COM initalized with COINIT_MULTITHREADED and has to be initialized with COINIT_APARTMENTTHREADED. Using the single threaded COBOL runtime also avoids this error.


