In the WINAPI Reference it is said that this field of the structure is
used either in open and save file dialogs, so if you are opening a file
you can type the name without the extension and then it adds it if it
does not find a file with the provided name and without extension.
In my trials I've proved to use it, so it displays the files with the
extension of the first filter and when typing a name without extension
it search for the second one; but it always try to add the first filter
of the buffer, or the one pointed by nFilterIndex, but never to the
extension assigned to lpszDefExt.
So it's a bug in the API or the documentation about what I warn here.
I had to pass to the OPENFILENAME the OFN_ENABLEHOOK flag, the hook
function and in its WM_INITDIALOG message call the function
CommDlg_OpenSave_SetDefExt(GetParent(hwnd)[1], my_defext);
[1] This is because the dialog box is the parent of the hwnd that is the
HWND parameter of the function, which is UINT APIENTRY.
|