Now, in my case, I've a need to create n-th number of modeless dialogs at runtime and access them from other parts of the program.

Of course, I can easily achieve this by creating them locally, as in something like :
Code:
for(int i = 0; i < 10; i++)
{
    CMyModelessDialog* pDlg = new CMyModelessDialog();
    pDlg->Create(IDD_DIALOG1,this);
    pDlg->ShowWindow(SW_SHOW);
}
This works, but the problem with this approach is that if I wanna access these dialogs from other classes or other parts of the same classes(other function etc.), it's totally impossible, cos' these dialog pointers are local.

The member/global dialog pointer approach whereby you create member/global pointers to hold the dialogs doesn't work too, cos' in my case, you dunno how many member/global dialog pointers to create to hold the n-th number of modeless dialog, because it can be any number at run-time.

Another probable way is to use a single member/global dialog pointer with the new and delete operator to create dialogs. But this is impossible when u try it out, and even if it's possible, there's no way to access a desired dialog, cos' this pointer will always be set to the latest dialog you created.

So, my question is :

Is it possible to create n-th number of modeless dialogs at run-time and STILL have valid pointers to access them from other parts of the program at any time?

Please and thanks a lot! Thanks!
Xeon.