Pass the correct HWND to MSWOnInitDone()

Instead of requiring the function itself to use GetParent(), call it in
the hook function and pass the actual dialog HWND to MSWOnInitDone().

No real changes, just refactoring to prepare for further changes.
This commit is contained in:
Vadim Zeitlin
2022-05-25 19:10:31 +01:00
parent 56bb9c2420
commit 1de1c62872

View File

@@ -319,7 +319,9 @@ wxFileDialogMSWData::HookFunction(HWND hDlg,
switch ( pNM->code )
{
case CDN_INITDONE:
dialog->MSWOnInitDone((WXHWND)hDlg);
// Note the dialog is the parent window: hDlg is a
// child of it when OFN_EXPLORER is used
dialog->MSWOnInitDone((WXHWND)::GetParent(hDlg));
// Call selection change handler so that update
// handler will be called once with no selection.
@@ -502,18 +504,14 @@ void wxFileDialog::MSWOnInitDone(WXHWND hDlg)
return;
}
// note the dialog is the parent window: hDlg is a child of it when
// OFN_EXPLORER is used
HWND hFileDlg = ::GetParent((HWND)hDlg);
// set HWND so that our DoMoveWindow() works correctly
TempHWNDSetter set(this, (WXHWND)hFileDlg);
TempHWNDSetter set(this, hDlg);
if ( m_data->m_centreDir )
{
// now we have the real dialog size, remember it
RECT rect;
GetWindowRect(hFileDlg, &rect);
GetWindowRect(hDlg, &rect);
gs_rectDialog = wxRectFromRECT(rect);
// and position the window correctly: notice that we must use the base