View Single Post
  #7  
Old 10-24-2016, 05:49 AM
ShaunVW ShaunVW is offline
Member
 
Join Date: Feb 2012
Posts: 47
Default

I have found the problem, and it was being caused from the main program!
I have a lot of threads being called from the main program, so in testing this thread, not sure what I thinking when I wrote the code below, but I was calling the procedure that set up the thread, and then told the application to shutdown!
This is what I had...

Code:
 
  Birthdays();
  Application.Terminate;
  exit;
Obviously it just needed the exit, not the Appllication.Terminate;

Norrit, thanks for pointing me back to the main program, even if it wasn't the CoInitialize that was the problem. Just to answer your question though, I only call these threads once at a time, and if it is still busy, I don't try calling it again, so there will never be a time when CoInitialize has been invoked more than once per thread.