I'm attempting to implement a MVP pattern in my latest project. Currently using the VCL library that comes with C++ Builder 2007. My thinking is I don't need to do Application->Run(), or worse Application->CreateForm() which creates a main form and loop on that form. I don't want a main form, I want a main Presenter, instead.
My question then becomes how to create threaded TForms?
Option 1: If there is only one message loop (the Presenter) then every random thread in my system would have to post a message to this main thread and have it create forms.
Option 2: Every form has its own message loop. Now random threads can new and delete them as needed. Posting messages is still used for communications between them.
If option 2 is recommended does anyone have any advice on implementing this approach?
EDIT: How might I change the following to allow for creating the form using new and still allow the loop to work?
// Start VCL library
pApplication->Initialize();
// Create the Main form and assign the MainForm property
pApplication->CreateForm(__classid(TForm1), &pFormMain);
// Show the form
pFormMain->Show();
// Run the loop
pApplication->Run();