0 Members and 2 Guests are viewing this topic.
Image zero;HBITMAP img = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP0));zero.LoadFromMemory((const char*) img, sizeof(img));
Thanks, and according to MSDN LockResource doens't actually lock anything as of XP.But now my issue is what to put for the SizeInBytes in LoadFromMemory.
Width * Height *4
Failed to load image from memory. Reason : Image not of any known type, or corrupt
Image zeroimg;HRSRC hresource = FindResource(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP1), RT_BITMAP);HGLOBAL hglobal = LoadResource(GetModuleHandle(NULL), hresource);LPVOID lpvoid = LockResource(hglobal);zeroimg.LoadFromMemory((const char*) lpvoid, SizeofResource(GetModuleHandle(NULL), hresource));
Quote from: "JAssange"Width * Height *4No, he needs the size of the bitmap/whatever file.To get the size of a resource,use SizeofResource:http://msdn.microsoft.com/en-us/library/ms648048%28v=vs.85%29.aspx
I did mean the SFML function, but I get the same result with both width*height*4 and SizeofResource().