简体   繁体   English

Windows GDI上下文-LoadImage

[英]Windows GDI Context - LoadImage

Using LoadImage() causes segmentation fault. 使用LoadImage()会导致分段错误。 Backtracing the stack I found the following function as called last: AlpcMaxAllowedMessageLength() 回溯堆栈,我发现以下函数称为last: AlpcMaxAllowedMessageLength()

This is the function I call: 这是我调用的函数:

status = (HBITMAP) LoadImage(NULL, MAKEINTRESOURCE(STATUS_BMP), IMAGE_BITMAP, 0, 0,  LR_LOADFROMFILE | LR_CREATEDIBSECTION));

with STATUS_BMP loaded as a valid resource bitmap file. STATUS_BMP作为有效资源位图文件加载。 Has someone encountered a similar problem about this function, or just have the solution to the matter? 有人遇到过与此功能类似的问题,还是只是有解决方案?

I believe your issue is the fact that you are specifying that you want the image to be loaded from file by the LR_LOADFROMFILE flag, which means that the second parameter needs to be the string name of the standalone image file (this usually means on disk). 我相信您的问题是您通过LR_LOADFROMFILE标志指定要从文件中加载图像,这意味着第二个参数必须是独立图像文件的字符串名称(通常是在磁盘上) 。 You might try removing the LR_LOADFROMFILE flag and see if that fixes the issue. 您可以尝试删除LR_LOADFROMFILE标志,看看是否可以解决问题。

http://msdn.microsoft.com/en-us/library/windows/desktop/ms648045(v=vs.85).aspx http://msdn.microsoft.com/zh-CN/library/windows/desktop/ms648045(v=vs.85).aspx

When I have used this function, it has always been from a local file on disk. 使用此功能后,它始终来自磁盘上的本地文件。

MAKEINTRESOURCE and LR_LOADFROMFILE are mutually exclusive. MAKEINTRESOURCELR_LOADFROMFILE是互斥的。 Drop LR_LOADFROMFILE . 删除LR_LOADFROMFILE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM