Shell扩展:DragQueryFile返回最多16(在Windows 7中) [英] Shell Extension: DragQueryFile returns at most 16 (in Windows 7)

查看:633
本文介绍了Shell扩展:DragQueryFile返回最多16(在Windows 7中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个shell扩展(在指导写作Shell扩展),它的工作原理,直到我升级到Windows 7(32位)。



现在,函数DragQueryFile

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

返回所选文件的正确数量,直到数字大于16。 / p>

我在XP(32)和Vista(32)中测试过,在Windows7(32/64)中没有测试。



任何想法?



谢谢。

解决方案

在调用命令之后,就会在shell调用IContextMenu.InvokeCommand()之前再次调用IShellExtInit.Initialize()方法,并显示完整的文件列表。然后,您有机会再次收集文件列表。
你不能依赖第一次Initialize()调用的文件计数,所以如果超过16,就不要在上下文菜单项中显示它。


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.

解决方案

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.

这篇关于Shell扩展:DragQueryFile返回最多16(在Windows 7中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆