Description: This article presents a method for easily managing modeless dialogs. Functionality includes:
Determining if the dialog is already created
Closing the dialog automatically when the parent object is destroyed
Notifying the parent object when the dialog is closed
Accessing functions in the dialog from the parent object.
The concept is based on a tracker object that exists in the dialog s parent and a helper class from which the dialog is dual-derived. The helper class automates the interaction between the dialog and its tracker, and the tracker allows the parent to manage the dialog.
The term "parent" is used to represent the class that creates the modeless dialog and is therefore responsible for keeping an eye on it. The parent is not necessarily a parent window. It could be any object that needs to have a modeless dialog.
To Search:
File list (Check if you may need any files):
ModelessDialogTrackerDemo\DialogA.cpp
.........................\DialogA.h
.........................\DialogB.cpp
.........................\DialogB.h
.........................\DialogC.cpp
.........................\DialogC.h
.........................\ModelessDialogTracker.cpp
.........................\ModelessDialogTracker.h
.........................\ModelessDialogTrackerDemo.cpp
.........................\ModelessDialogTrackerDemo.h
.........................\ModelessDialogTrackerDemo.rc
.........................\ModelessDialogTrackerDemo.sln
.........................\ModelessDialogTrackerDemo.suo
.........................\ModelessDialogTrackerDemo.vcproj
.........................\ModelessDialogTrackerDemoDlg.cpp
.........................\ModelessDialogTrackerDemoDlg.h
.........................\ReadMe.txt
.........................\res
.........................\...\ModelessDialogTrackerDemo.ico
.........................\...\ModelessDialogTrackerDemo.manifest
.........................\...\ModelessDialogTrackerDemo.rc2
.........................\resource.h
.........................\stdafx.cpp
.........................\stdafx.h
.........................\TrackDialogC.cpp
.........................\TrackDialogC.h