Reputation: 4143
I open an open file dialog using GetOpenFileName
function. I'm making a handler function that will center the dialog window inside the owner window. I center the dialog on CDN_INITDONE
notification.
Currently, it seems that Windows remembers last dialog position for desktop apps and overrides my dialog coordinates. How to reset that last remembered position so that I can check centering will work for my users?
I thought about running a test using a different user or virtual machine but this isn't very convenient. Unfortunately, searching in the registry for myexecutable.exe returns nothing.
I'm running Windows 8.
Upvotes: 2
Views: 837
Reputation: 1362
I'm about a year late, but I just had to deal with this issue. What worked for me was supplying an OFNHookProc
to GetOpenFileName()
, then subclassing the parent of the HWND passed to the OFNHookProc
.
After subclassing, I handle WM_WINDOWPOSCHANGED
, and if the coordinates aren't where I think they should be, I do a SetWindowPos()
, undo the subclass and return 0.
Edit: I should say that other methods, such as WM_INITDIALOG
in the hook proc or CDN_INITDONE
did not work for me whatsoever.
Upvotes: 2