INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: album thumbnails in C++  (Read 1804 times)

aseiden

  • Regular Member
  • Recent member
  • *
  • Posts: 8
album thumbnails in C++
« on: December 18, 2004, 02:28:22 pm »

Hi folks,

I have what's probably a dumb newbie question about trying to load an album thumbnail in VS C++.  I'm trying to use the following code, which is based on the CImage docs that MicroSoft provides:

Code: [Select]

    // get imagefile name from MJ
    _bstr_t thumbnailfile = album->GetImageFile(IMAGEFILE_THUMBNAIL_MEDIUM);

    // Load thumbnail
    CImage thumb;
    HRESULT hr = thumb.Load(thumbnailfile);
    CBitmap* pBitmap = CBitmap::FromHandle(thumb.m_hBitmap);

but this won't even compile--I get an error that complains that the in the last line, m_hBitmap is a private member of CImage.  But this is the way the MS samples show to use CImages with CBitmaps, which are needed for controls, etc, so I'm confused!

I'm an experienced C programmer, but I'm new to Windows, C++, and MC programming.  I'm trying to teach myself all of those things on this project, so my apologies if my questions are stupid.

Any help appreciated--either as to what I'm doing wrong or if there is an alternate way of doing this better.   (Of course, if JR would like to expose their JRImage methods, that would be great, too!)

thanks very much!
--Alex
Logged

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re: album thumbnails in C++
« Reply #1 on: December 19, 2004, 03:40:44 am »

Maybe OleLoadPicturePath would meet your requirements:


//  Get the thumbnail filename
_bstr_t thumbnailfile = album->GetImageFile( IMAGEFILE_THUMBNAIL_MEDIUM );

//  Load the picture
IPicture* picture;
::OleLoadPicturePath( thumbnailfile, NULL, 0, 0, IID_IPicture, (LPVOID*)&picture )

//  Get the HBITMAP
HBITMAP   hBitmap;
picture->get_Handle( (OLE_HANDLE*)&hBitmap );

//  Free the picture
picture->Release();




Note that error checking has been exlcuded for brevity.   Also when you get the HBITMAP you can load it into a CBitmap if you really need to.
Logged

aseiden

  • Regular Member
  • Recent member
  • *
  • Posts: 8
Re: album thumbnails in C++
« Reply #2 on: December 19, 2004, 11:55:17 pm »

Thanks, Rhino!  Your code works--now I have to make my CImageList stuff play nicely with it.

Cheers,
Alex
Logged
Pages: [1]   Go Up