加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows – 如果我使用LoadIconWithScaleDown创建它,是否需要调

发布时间:2020-12-14 02:21:58 所属栏目:Windows 来源:网络整理
导读:我正在使用 LoadIconWithScaleDown() 在我的应用程序中创建图标.如果首选功能不可用,我也会回到 CreateIconFromResourceEx() . DestroyIcon() 的文档指出: It is only necessary to call DestroyIcon for icons and cursors created with the following fun
我正在使用 LoadIconWithScaleDown()在我的应用程序中创建图标.如果首选功能不可用,我也会回到 CreateIconFromResourceEx().

DestroyIcon()的文档指出:

It is only necessary to call
DestroyIcon for icons and cursors
created with the following functions:
CreateIconFromResourceEx (if called
without the LR_SHARED flag),
CreateIconIndirect,and CopyIcon. Do
not use this function to destroy a
shared icon. A shared icon is valid as
long as the module from which it was
loaded remains in memory. The
following functions obtain a shared
icon.

  • LoadIcon
  • LoadImage (if you use the LR_SHARED flag)
  • CopyImage (if you use
    the LR_COPYRETURNORG flag and the
    hImage parameter is a shared icon)
  • CreateIconFromResource
  • CreateIconFromResourceEx (if you use
    the LR_SHARED flag)

注意:我没有将LR_SHARED传递给CreateIconFromResourceEx();也许我应该.

我想知道的是,我是否需要为使用LoadIconWithScaleDown()创建的图标调用DestroyIcon()?

解决方法

我会说是的,因为根据文档,你回来的HICON似乎没有被分享. Windows显然不希望你销毁其句柄共享的图标,但这不是这里的情况,如果你回退到另一个需要LR_SHARED的函数,但你没有传递标志,那么这意味着你的进程拥有图标处理,你应该在使用它时将其销毁.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读