Thread: MFC dll calling outlook 2010 spawing multiple threads

  1. #1
    Registered User
    Join Date
    Sep 2013
    Posts
    6

    MFC dll calling outlook 2010 spawing multiple threads

    Hi Everyone,
    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.

  2. #2
    Registered User ledow's Avatar
    Join Date
    Dec 2011
    Posts
    435
    Show code.

    And I highly doubt that a DLL leaving threads around is making your program crash at all. It sounds entirely unrelated.

    - Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
    - A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
    - The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple Threads
    By NuNn in forum C Programming
    Replies: 3
    Last Post: 03-14-2009, 11:29 PM
  2. Replies: 6
    Last Post: 01-09-2007, 04:12 PM
  3. Outlook/Outlook Express .dbx files
    By dit6a9 in forum Windows Programming
    Replies: 1
    Last Post: 05-18-2005, 11:33 AM
  4. a point of threads to create multiple threads
    By v3dant in forum C Programming
    Replies: 3
    Last Post: 10-06-2004, 09:48 AM
  5. Replies: 8
    Last Post: 09-22-2003, 01:31 PM

Tags for this Thread