This is a minor, but annoying issue, and I don't understand why MS have seemingly made it so complicated!
I've created a customised CFileDialog-derived class for opening image files using the 'new' IFileDialog
, IFileDialogEvents
and IFileDialogControlEvents
interfaces. It is all working as intended with my custom controls added (though the lack of control re where these go is a secondary annoying issue!).
The problem is, the dialog will not display centred in my application window, no matter what I try to do. There is also no OnInitDone
or OnInitDialog
I can use to reposition it.
Firstly, why is it not centred in the window I specified as the parent / owner? Secondly, why is it so difficult / impossible to reposition it after the fact?
I don't know how relevant it is but this is how I set it up:
COpenImageFileDialog ifd(TRUE, JPG_EXT, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, IMAGE_FILTER, AfxGetMainWnd());
CString sTitle = RESSTR(IDS_IMPORT_IMAGE);
ifd.m_ofn.lpstrTitle = sTitle;
ifd.m_ofn.hwndOwner = AfxGetMainWnd()->GetSafeHwnd();
ifd.m_ofn.hInstance = AfxGetInstanceHandle();
if (ifd.DoModal() == IDOK)
{