user2210724
user2210724

Reputation:

CFileDialog::OnInitDialog() does not call

I am using custom file dialog which is extended from the CFileDialog. The problem is that, OninitDialog() does not get called before DoModal().

I have customized the CFileDialog in the OninitDialog().

I am using VS 2012 with Win7 OS.

I could not find out, what is going wrong.

Upvotes: 6

Views: 2751

Answers (2)

Pop Cristian
Pop Cristian

Reputation: 31

I just run into same issue today; I think I found a valid solution, in constructor of your class just set m_bVistaStyle = FALSE; After doing this, I got OnInitDialog and I was able to customize this dialog just fine.

CMyOpenDlg::CMyOpenDlg(LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
      DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
      CFileDialog(TRUE, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
   m_bVistaStyle = FALSE;

Upvotes: 3

Jabberwocky
Jabberwocky

Reputation: 50778

The Microsoft documentation says that OnInitDialog is not supported on Windows Vista. The same is true for Windows 7 (and probably also for Windows 8).

Upvotes: 2

Related Questions