Ok, heres the deal I've been working on this problem that ive had to other questions open on and to be honest I had the code working from some links provided to me by another expert, however I made the mistake of leaving the only code for it on a pen drive that got ruined today at work (*yay for coffee). Because I'm like many people that dont back things up often enough I had to rewrite my code, now I cant get the code working again and I dont know why.
Here is the code segment im using to load a picture from file and get the HGLOBAL of the DIB; the only problem is when I try to GlobalLock or GlobalSize the HGLOBAL I get 0 for size and no handle from GlobalLock.
, 0, szPath, -1, wpath, MAX_PATH);
HBITMAP hPic = NULL;
OleLoadPicturePath(wpath, NULL, NULL, NULL, IID_IPicture, (LPVOID *)&pic);
HGLOBAL hDib = cDib.BitmapToDIB(hPic);
GetObject(hPic, sizeof(DIBSECTION), &info);
pPtr = GlobalLock(&hDib);
nSize = GlobalSize(&hDib);
Can anyone tell me what Im doing wrong here that is causing me to not get the size and other information? I've already verified that the image is being loaded and right now Im kicking myself for not backing up, especially when Im not good with C++.
Code segment for "BitmapToDib":
Goto that link and scroll down to the code migel posted... now this is the code that saved me last time but for the life of me I cant figure out what Im missing now that Im forced to recreate it.
I need to get the size of the DIB in memory so I can store the handle and size of the DIB in a vector, which is what im attempting to do.