加载资源dll图片问题。 - C++ Builder / Windows SDK/API
资源dll,里面存有bmp,jpg和gif三张图片,我想呈现出来,但只是出来了bmp的,jpg和gif的搞部出来,大家帮看看啊
HMODULE hint;
hint=LoadLibrary("image1.dll");
HBITMAP hBitmap;
hBitmap=LoadBitmap(hint,MAKEINTRESOURCE(IDB_BITMAP1));
HRSRC hr=FindResource(hint,MAKEINTRESOURCE(IDR_JPG1),"JPG");
HGLOBAL hGolbal;
hGolbal=LoadResource(hint,hr);
LPSTR lp=(LPSTR)LockResource(hr);
this->Image1->Picture->Bitmap->Handle=hBitmap;
此时jpg这张图片已经得到相应的内存地址,但是怎么给picture呢,很费解
[解决办法]
TResourceStream *stm = new TResourceStream(hint,IDR_JPG1,"JPG");TJPEGImage *jpg = new TJPEGImage;jpg->LoadFromStream(stm);this->Image1->Picture->Assign(jpg);delete jpg;delete stm;