我正在使用 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 但你没有传递标志的函数,那么这意味着你的进程拥有该图标handle,用完后应该销毁它。
关于windows - 如果我使用 LoadIconWithScaleDown 实现,是否需要调用 DestroyIcon?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5276390/