I do call TForm::Close() to close the form when Outlook closes, or
more specificly when the explorer or inspector closes, or my add-in is
unloaded. TForm::Close() doesn't free the object until the remove
message is processed though. I guess I could just use PeekMessage()
to only process the remove message, or maybe it is safe to use the
delete opperator on a TForm, but I've never tried that. I could
probably have to call Close() first, and then delete, so the window
handles get destroyed?
But before I get way off-topic for this group (oops too late), and
into a VCL group topic, I'm still wondering if I can process messages
during these other lengthy processes which might take several seconds
to complete. I'd rather not use seperate threads, mostly because most
COM add-ins I see don't do it, and I don't want to be making the
add-in that flushes out all the bugs/issues related to this. I will
be using purely Extended MAPI during these processes, so I guess
another thread is an option still, I'm just gun-shy when it comes to
calling MAPIInitialize() myself, because 75% of the error messages
reported by users have been that the call to MAPIInitialize() fails,
even though they are quick to point out "Outlook is working just fine,
and it initializes MAPI, how come your application can't".
Thanks!
"Dmitry Streblechenko" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> No, Outlook COM addins run in the main Outlook thread. You can however run
> your code in your own threads.
> Why do you need to run a message loop and wait for the modeless VCL forms to
> be closed? Why can't you close them programmatically? Or better yes, make
> your forms children of the Outlook explorers/inspectors (so that they don't
> get their own task bar buttons) and close them whenever the parent Outlook
> window closes - see uParentedWnd.pas in the Babelfish addin source code on
> my site.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>