Shell Extension: DragQueryFile returns at most 16 (in Windows 7)

♀尐吖头ヾ 提交于 2020-02-01 05:50:05

问题


I've writtten a shell extension (guided by The Complete Idiot's Guide to Writing Shell Extensions) which worked as it should until I upgraded to Windows 7(32bit).

Now, the function DragQueryFile

UINT uNumFiles = DragQueryFile(hDrop,0xFFFFFFFF,NULL,0);

returns the right number of selected files until the number is above 16. Then always 16 is returned.

I've tested it in XP(32) and Vista(32), there it works, in Windows7 (32/64) it doesn't.

Any ideas?

Thanks.


回答1:


The IShellExtInit.Initialize() method is called once again, with full file list, after your command is invoked, just before IContextMenu.InvokeCommand() is called by the shell. Then you have the opportunity to collect the file list again. You just cannot rely on the file count on the first Initialize() call, so do not show it in your context menu item if it is over 16.




回答2:


I have seen some posts that talk about the limit of 16 files in explorer, and claim that the problem is solved changing the registry value of MultipleInvokePromptMinimum. This is not necessary, since the full list of files is retrieved in the second call just before the invokeCommand function is called. I proved this idea by writing in a registry key all files read on the initialize function, after deleting this registry key. This way, the list of files is updated every time initialize is called.



来源:https://stackoverflow.com/questions/2363911/shell-extension-dragqueryfile-returns-at-most-16-in-windows-7

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