I have written an MFC dialog based application which is launched by some another application. For now, I have not added any code. It is just the default files that I got. Th
First of all let me address some issues with previous solutions.
chintan s: Indeed dialog will be killed when function goes out of scope. It would be a valid solution if dialog was declared as a member variable of the app class.
Vikky: No need to call Windows API, since dialog is derived from CWnd and it inherits ShowWindow member that take only one parameter: show command.
ixe013: This solution will work, however, before dialog hides, it will flash, since ShowWindow is called before OnInitDialog is called.
Pete: This won’t work, since, modal dialog starts before m_pMainWnd has any value assigned to it.
The solution is pointed by ixe013.
This is so far the only solution that works but you will have to declare member variable in you dialog class, as described in the article.