Stencil
Stencil

Reputation: 1873

Windows GDI Context - LoadImage

Using LoadImage() causes segmentation fault. Backtracing the stack I found the following function as called 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. Has someone encountered a similar problem about this function, or just have the solution to the matter?

Upvotes: 1

Views: 615

Answers (2)

Wizetux
Wizetux

Reputation: 756

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). You might try removing the LR_LOADFROMFILE flag and see if that fixes the issue.

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

When I have used this function, it has always been from a local file on disk.

Upvotes: 3

Adrian McCarthy
Adrian McCarthy

Reputation: 47952

MAKEINTRESOURCE and LR_LOADFROMFILE are mutually exclusive. Drop LR_LOADFROMFILE.

Upvotes: 3

Related Questions