- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 FreeResource function - Microsoft Docs :
[This function is obsolete and is only supported for backward compatibility with 16-bit Windows. For 32-bit Windows applications, it is not necessary to free the resources loaded using LoadResource. If used on 32 or 64-bit Windows systems, this function will return FALSE.]
这是为什么呢?是不是内存大的原因?
最佳答案
像LoadBitmap()
这样的专门的资源特定函数将实际资源“后处理”为可用的GDI对象,这会消耗额外的内存和系统范围GDI表中的一个槽( limited to 64K handles)。因此,在完成 HBITMAP
后,需要调用 DeleteObject()
以释放关联的资源。
与 LoadBitmap()
不同(也与 16 位 Windows 不同),LoadResource()
不会在 Win32 中分配任何其他资源,而是“指向”该资源在已加载模块的内存映射镜像中。因此,Win32 中的 FreeResource()
无需清理任何内容。
引自 Raymond Chen 的 What's the difference between FreeResource and, say, DestroyAcceleratorTable :
In 16-bit Windows, loading a resource entailed allocating a chunk of memory, then filling that memory block from the disk image. In Win32, resources are mapped into the address space as part of the image; there is no memory allocation and no explicit loading.
关于winapi - 为什么 32 位 Windows 应用程序的值为 "not necessary to free the resources loaded using LoadResource"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63735320/
我通过 LoadLibrary 加载一个模块(exe/dll)并在其中获取一个二进制资源的指针。 Microsoft 说明应该使用三个步骤: 使用 FindResource 返回 HRSRC 将 Lo
我正在处理一个包含大量 HTML 资源的 Visual Studio C++ 项目。它们由如下所示的方法加载: LPCTSTR loadHTML(HMODULE hModule, LPCTSTR sR
我正在使用 Windows API 用 C 语言开发多语言 Win32 程序。它将允许用户选择界面的语言。根据MSDN documentation , 我需要使用 FindResourceEx() +
我正在使用一个内部 MFC 应用程序,它试图通过在使用 Win32 LoadResource 函数获得的 DLGTEMPLATEEX 结构中找到它并直接写入该结构的字体大小成员,以编程方式更改对话框的
在 FreeResource function - Microsoft Docs : [This function is obsolete and is only supported for back
在 FreeResource function - Microsoft Docs : [This function is obsolete and is only supported for back
我是一名优秀的程序员,十分优秀!