hDC 的内存管理
我有一个 ID3DXFont(顺便说一下,它是 Direct3D9),它提供了一个 GetDC() 方法,该方法返回设备上下文 (hDC) 的句柄。如何管理该值的内存? MSDN 没有提及任何相关内容,也没有像 COM 接口那样提供自己的内存管理。
I've got an ID3DXFont (which is Direct3D9, by the way) which offers a method GetDC() which returns a handle to a device context (hDC). How is the memory for this value managed? MSDN doesn't mention anything about it and it doesn't provide it's own memory management like COM interfaces do.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要使用
ReleaseDC(HDC)
释放该句柄。You need to release that handle with
ReleaseDC(HDC)
.不能在句柄上使用 SAFE_RELEASE 宏吗?
Can't you use SAFE_RELEASE macro on the handle?
我相信当您完成后,您必须在返回的句柄上调用
DeleteDC
。很难找到对此的太多参考,除了 this gamedev.net 上的线程。I believe you have to call
DeleteDC
on the handle returned, when you are done with it. It was difficult to find much reference to this, with the exception of a comment made in this thread on gamedev.net.