Mortis
April 26th, 2003, 10:40 AM
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);
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);