• Windows 右键扩展菜单实现中遇到的问题


    Windows 右键扩展菜单实现中遇到的问题
     
    1. 右键扩展实现目标
     
    实现效果如下:
     
        对于文本文件点击右键,在右键菜单中出现“SimpleShlExt Text Item”菜单项。
     
    2. 开发环境
        Windows7  32位
        VS2005
        
    3. 教程与参考资料
        《Windows Shell扩展编程完全指南》        请按照该指南的第一个例子做。
        《ATL开发指南》(用于补充学习)
     
     
    4. 遇到问题
     
    A.  Shell COM 从 VC6 移植到 VC2003或2005报错
          error C2787: 'IContextMenu' : no GUID has been associated with this object
        error C2440: 'initializing' : cannot convert from 'DWORD_PTR' to 'const IID *'
        error C2440: 'initializing' : cannot convert from 'ATL::_ATL_CREATORARGFUNC (__stdcall *)' to 'DWORD_PTR'
         根据博客《Shell COM 从 VC6 移植到 VC2003或2005的问题 》中的解释:
        There are two <comdef.h> header files in VC.NET, one in Vc7/include and the other in Vc7/PlatformSDK/include. 
        The former splits off the smart pointer typedefs into comdefsp.h, and it doesn't include IContextMenu. The latter does.
        You can try to #include the PlatformSDK header directly, change your INCLUDE path order。
     
        所以下载windows较新的PlatformSDK , 5.2.3790.1830.15.PlatformSDK_Svr2003SP1_rtm,可以从微软官网直接下载
        安装后C:\Program Files\Microsoft Platform SDK\Include
        打开comdef.h文件,可以看到缺失的GUID。
        
     
           调整include路径
            VS2005->Tools->Options
            
     
    B. 编译后,注册后仍没有效果
        
        通常VS2005生成的rgs文件包含了下面的内容
     
        而这三项仅仅是向注册表注册了你开发的DLL,而Explorer还不知道,也不知该在什么时候调用。
        所以要增加下面的内容。
            修改rgs文件,增加上面的内容。
            注册后,在注册表中,可以看到下面的内容。
         
        解决完这两个问题,我的右键菜单扩展功能已实现。
     




  • 相关阅读:
    《学技术练英语》PPT分享
    某网站漏洞排查经验
    【原创】如何写一个框架:模式
    【原创】如何写一个框架:步骤(下)
    【原创】如何写一个框架:步骤(上)
    CentOS 6.5 x64相关安全,优化配置
    CentOS 6.5 x64下查看服务版本
    Xshell设置密钥登录CentOS6.5_64位(文字命令版)
    CentOS 6.5 x64下安装宝塔面板、阿里安骑士
    CentOS 6.5 x64下查找依赖包,或用YUM安装
  • 原文地址:https://www.cnblogs.com/lqxinxin/p/3128222.html
Copyright © 2020-2023  润新知