Question

First of all, here's my config:

VS2010/Debug/C++ Win32 Project/Vista Home Premium

Invoking GetOpenFileName via a button (CreateWindow) in a window (CreateWindow) gets me no problem: The Open Dialog works fine, I can click, navigate to another folder etc...

Now, I replace my CreateWindow with a DialogBoxParam (that should call CreateWindow behind the scenes), with the same (DLGPROC)WndProc and invoke the same GetOpenFileName. Here, the Open dialog is behaving strangely: looks like only the mouse double-click works (= populating ofn.lpstrFile and closing the Open dialog). Not able to click the Open and Cancel buttons and not able to navigate.

Anyone having experienced this before? Any known reasons for the Open dialog to kind of "freeze". Belong to a parent or not (ofn.hwndOwner = hwnd; ofn.hwndOwner = NULL;) gives the same problem.

Thanks N

Was it helpful?

Solution

You wrote

with the same (DLGPROC)WndProc

That's your bug. A dialog procedure and a window procedure are not the same thing. They follow different rules, and if you follow WndProc rules when you should be following DlgProc rules, then bad things will happen.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top