How can I add a simple checkbox on a CFileDialog?
MFC seems to have a function CFileDialog::AddCheckButton
, which unfortunately is not implemented in WTL..
These missing features (which I find elementary) are getting annoying. Or is WTL just not for me?
This is not so elementary.
CFileDialog
is not exactly the implementation for this functionality, and instead is a wrapper overOPENFILENAME
and friends standard API. It is possible to change layout and add controls, however keep in mind this is achieved by hooking/subclassing the window and adding controls and message handlers via Win32 API.WTL does not offer you helper methods for customization, but it enables the hooking internally (initializing
lpfnHook
and mapping it to WTL-standardStartDialogProc
dialog proc) to help you with quick start. You are supposed to derive from this class, override message handling and you can start your customization from there.Also note that this is a wrapper over deprecated API. WTL also provides you with fresher stuff:
CShellFileOpenDialog
,CShellFileSaveDialog
.Code Snippet
This is how you extend the class:
Then you do:
And you get your control on the bottom: