I have been able to send an email using an MFC dll(32 bit) that would interface with outlook 2010 (using 32 bit outlook). The MFC dll is implicitly linked to the mso.dll. I am using a native C application to send email using outlook and have been successfull (partially). I am using the LoadLibrary() and GetProcAddress() to access my MFC dll functions to handle sending the email. However, my application crashes when I try to exit the application. After investigating this further, I noticed that when my MFC dll connects to the outlook process, five additional threads are launched ( I assume because I am using CoInitialize()). These threads do not self terminate when I unload the mfc dll using FreeLibrary(), which is why my native C app is crashing on exit.
I can brute force and terminate the app using exit(0), but I would like to understand how to handle these additional threads. I am new to multi -thread programming and I realize this is pretty vast subject and cannot be learned quickly. However, I would like any constructive input towards understanding how I can solve this issue.
thanks in advance.