OFN_ENABLEHOOK modifies the look of GetOpenFileName()

拥有回忆 提交于 2019-12-07 21:47:30

问题


Why does adding a hook procedure (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?


回答1:


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.



来源:https://stackoverflow.com/questions/4731218/ofn-enablehook-modifies-the-look-of-getopenfilename

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!