开发者

OFN_ENABLEHOOK modifies the look of GetOpenFileName()

Why does adding a hook p开发者_Python百科rocedure (with the OFN_ENABLEHOOK and OFN_EXPLORER flags) to GetOpenFileName() causes a different dialog to be displayed in Windows 7, if the hook procedure just returns FALSE without doing anything?


Update:

Apparently getting the Vista/Windows 7 look with a hook is impossible... can someone confirm or counter this?


The reason for this is that MS completely re-organised the file dialogs for Vista. Hooks are used to extend a file dialog by supplying a resource file. This gives the customiser too much power. They can all too easily modify standard elements of the dialog and indeed many apps did so. The reorganisation of the dialogs would have broken many apps that used hooks. Those would have tried to manipulate elements of the dialog that were not there, or were implemented differently. Legacy versions of the dialogs remain for such apps to "get their hooks into".

You are correct that it is impossible to get the new look when you use a hook. Instead you need to use the IFileDialogCustomize interface to customise the dialog. This is less powerful but does result in appearance and behaviour that is more consistent with the standard part of the dialog.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜