An olde worlde open file dialog

Windows specific questions.
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: An olde worlde open file dialog

Post by deltarho[1859] »

jj2007 wrote:This behaviour is very odd - how does Windows remember that folder?
That had me going for a while.

They use something called PidIMRU using REG_BINARY and not REG_SZ. It is not exactly encryption but for mere mortals it is as good as. They really do not want us messing with that stuff. Remember Microsoft have our best interests at heart. <cough>

I have been playing around with the registry since Windows 98 and know my way around. Having said that, I was in there a few days ago trying something and lost Windows. I ended up with a blue screen advising I had a problem and a repair was under way. It failed three times so I gave up and went to my 04:00 backup and got back to the desktop in good order. I have my FreeBASIC development on F: and that is backed up regularly on I:, an external SSD, where my C: backups are.
Last edited by deltarho[1859] on May 31, 2018 3:04, edited 1 time in total.
Josep Roca
Posts: 564
Joined: Sep 27, 2016 18:20
Location: Valencia, Spain

Re: An olde worlde open file dialog

Post by Josep Roca »

> So, we no longer need a hook?

Only if you want to center the dialog in the screen or do some special filtering. But we can't have all. If we use the wszFile workaround, the hook is not called. If we use a hook, then we get the XP appearance and the function will remember the most recent used folder.

For backward compatibility, they have kept code going back to Windows 3.1. With Windows 2000 and earlier, it didn't remember the last folder used. In Windows XP they changed the dialog appearance and the behaviour. In Windows 7 they changed it again and implemented the IFileDialog interface, but as there was old code using an hook, they kept it but using the old XP appearance and behaviour. And using a path in wszFile is clearly a hack. In the IFileDialog documentation there is a OFN_NOCHANGEDIR flag, but it only works with the save file dialog, not with the open file dialog... No wonder that many applications use its own custom dialogs.

Another dialog that seems to change with each version of Windows is the browse for file dialog.
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: An olde worlde open file dialog

Post by deltarho[1859] »

When I first saw OFN_NOCHANGEDIR: Restores the current directory to its original value if the user changed the directory while searching for files.

I thought, just what we need.

It followed with "This flag is ineffective for GetOpenFileName."

I then thought, it f*****g would be, wouldn't it? <laugh>
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: An olde worlde open file dialog

Post by jj2007 »

deltarho[1859] wrote:They use something called PidIMRU using REG_BINARY and not REG_SZ.
Do you have any link for that? Google refuses to cooperate...
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: An olde worlde open file dialog

Post by deltarho[1859] »

jj2007 wrote:Do you have any link for that?
No. Could not find anyone who gave a half decent description so I gave up on Google and searched the registry instead.

Have a look at:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32

You probably know this - maybe not. Anyway, copy the above and paste into the top of the Registry Editor and press Enter. You will fly to ComDlg32 - saves navigating. <smile.
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: An olde worlde open file dialog

Post by jj2007 »

deltarho[1859] wrote:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32
Over 2MB in NT4 text format. That explains something... thanks, good find.
Post Reply