Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Displaying Jpg in Listview

Displaying Jpg in Listview

Scheduled Pinned Locked Moved C / C++ / MFC
graphicslearning
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mortis
    wrote on last edited by
    #1

    I'm trying to make a list of thumbnails in a listview window. So far I can only make it work with resource bitmaps, when i try a hard coded jpg, i get get a blank image, with "hiya" under it Its probally something really dumb, but i just cant find it. If anyone could point it out i'd be very grateful (I'm almost positive its not the Bmp variable, the function does return a BITMAP) //Here's the code //Opens a thumbnail struc and sets its x and y thumb = openThumb(&x ,&y); _bstr_t txt("Hiya"); //Gets Handle to the listControl hThumbList = GetDlgItem(g_hWnd ,IDC_LIST_THUMB); //x = 160, y = 120 hImageList = ImageList_Create(x,y,ILC_MASK | ILC_COLOR32,0,0); Bmp = getThumbBmp(g_hWnd,hPicDC); //Returns a HBITMAP //Adds bitmap to the list as position 0 ImageList_Add(hImageList, Bmp, NULL); SendDlgItemMessage(g_hWnd,IDC_LIST_THUMB,LVM_SETIMAGELIST,0,(LPARAM)hImageList); lvi.mask = TVIF_TEXT | TVIF_IMAGE; lvi.pszText = txt; lvi.iImage = 0; //First Image added // Insert info to the Listview SendMessage(hThumbList ,LVM_INSERTITEM,0,(LPARAM)&lvi);

    L 1 Reply Last reply
    0
    • M Mortis

      I'm trying to make a list of thumbnails in a listview window. So far I can only make it work with resource bitmaps, when i try a hard coded jpg, i get get a blank image, with "hiya" under it Its probally something really dumb, but i just cant find it. If anyone could point it out i'd be very grateful (I'm almost positive its not the Bmp variable, the function does return a BITMAP) //Here's the code //Opens a thumbnail struc and sets its x and y thumb = openThumb(&x ,&y); _bstr_t txt("Hiya"); //Gets Handle to the listControl hThumbList = GetDlgItem(g_hWnd ,IDC_LIST_THUMB); //x = 160, y = 120 hImageList = ImageList_Create(x,y,ILC_MASK | ILC_COLOR32,0,0); Bmp = getThumbBmp(g_hWnd,hPicDC); //Returns a HBITMAP //Adds bitmap to the list as position 0 ImageList_Add(hImageList, Bmp, NULL); SendDlgItemMessage(g_hWnd,IDC_LIST_THUMB,LVM_SETIMAGELIST,0,(LPARAM)hImageList); lvi.mask = TVIF_TEXT | TVIF_IMAGE; lvi.pszText = txt; lvi.iImage = 0; //First Image added // Insert info to the Listview SendMessage(hThumbList ,LVM_INSERTITEM,0,(LPARAM)&lvi);

      L Offline
      L Offline
      Lior Shoval
      wrote on last edited by
      #2

      simple, imageList doesn't support jpeg compressed images. only raw bitmaps. try using GDI+ to load the jpeg and then get an HBITMAP from it.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups