In general you create a modeless dialogue in a function, and then return to do other processing, when you close the dialogue box it usually frees up the memory allocated on the heap itself.
If the dialogue box memory was on the stack, then it would be lost when you returned form the function.
Allocation on the stack is efficient, and if the thread creating the box waits for the box to be closed before proceeding, there is no real reason to complicate life by creating the box on the heap, and then remembering to delete the box when you have completed.
Modaless dialog box can't be created on the stack...because u have to call a Create fucntion for this type of dialog box...What i think the secret lies in the heap ..heap is the extra memory which is being used by the programm(or application) and there is a separate thread to manage the heap and that's why u can do other while while the modaless dialog box is visible....where as the stack objects are managed by the same thread of the application and hence
the control gets trapped there....
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.