Bonjour, j'ai un petit soucis dans mon projet (pour mon bts), en fait je voudrais associer des photos (format jpeg) à une Ctrlistet et les afficher en miniature dedans , mais 3 petites erreurs se glissent...

infos :
- nom de la ctrlist : photos.
- je dispose de la variable cheminPhoto qui contient l'URL de la photo a afficher en miniature.

voici mes erreurs :
- error C2664: 'CWnd::Attach' : impossible de convertir le paramètre 1 de 'HIMAGELIST' en 'HWND'
- error C2039: 'Add' : n'est pas membre de 'CListCtrl'
- error C2664: 'CListCtrl::SetImageList' : impossible de convertir le paramètre 1 de 'CListCtrl *__w64 ' en 'CImageList *'


Le mieux c'est que je vous colle ma fonction qui se charge de faire ça.


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
void CphotographeIHMView::choisirRepSource()
{
    CRect rect;
    photos.GetClientRect(&rect);
    int nColInterval = rect.Width()/5;
 
    photos.InsertColumn(0, _T("Item Name"), LVCFMT_LEFT, nColInterval*3);
    photos.InsertColumn(1, _T("Value"), LVCFMT_LEFT, nColInterval);
    photos.InsertColumn(2, _T("Time"), LVCFMT_LEFT, rect.Width()-4*nColInterval);
 
    HIMAGELIST hList = ImageList_Create(32,32, ILC_COLOR8 |ILC_MASK , 8, 1);
    photos.Attach(hList);
 
    CBitmap cBmp;
    cBmp.LoadBitmap(IDC_LIST_photos);
    photos.Add(&cBmp, RGB(255,0, 255));
    cBmp.DeleteObject();
 
    photos.SetImageList(&photos, LVSIL_NORMAL);
 
    LVITEM lvi;
 
    //récupération du circuit délectionné dans la comboBox
    CString circuitSelectionne ;
    int nIndex = circuit.GetCurSel();
    if(nIndex!=LB_ERR) circuit.GetLBText(nIndex,circuitSelectionne);
 
    //création d'un filtre pour la sélection des photos dans la CFileOpenDialog
    CString OpenFilter;
    OpenFilter = "Images (*.jpg)|*.jpg|";
 
    //création de la CFileOpenDialog
    CFileDialog FileOpenDialog
    (
        TRUE,
        NULL,
        NULL,
        OFN_ALLOWMULTISELECT|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST,
        OpenFilter,        // filter
        this // the parent window
    );
 
    //création d'un buffer
    CString fileName;
    FileOpenDialog.GetOFN().lpstrFile = fileName.GetBuffer(20000);
    FileOpenDialog.GetOFN().nMaxFile = 20000;
 
    //BOOL rep = FileOpenDialog.DoModal();
    if(FileOpenDialog.DoModal()==IDOK)
    {
        int num= 1; //pour le numéro temporaire des photos.
        POSITION pos=FileOpenDialog.GetStartPosition();
        while(pos)
        {
            //récupération du chemin de la photo en cours
            CString cheminPhoto;
            cheminPhoto = FileOpenDialog.GetNextPathName(pos);
 
            //appel de la fonction legenderPhotos() de la classe photographeIHMDoc, elle est chargée de copier les photos dans un autre répertoire que celui ou                 //l'utilisateur a sélectionné les photos a traiter.
            GetDocument() -> lengenderPhotos(cheminPhoto, num, circuitSelectionne);
 
            //affichage de la photo dans la ctrlist
 
            // Insert the first item
            lvi.mask =  LVIF_IMAGE | LVIF_TEXT;
            cheminPhoto.Format(_T("Item %i"), num);
            lvi.iItem = num;
            lvi.iSubItem = 0;
            lvi.pszText = (LPTSTR)(LPCTSTR)(cheminPhoto);
            lvi.iImage = num%8;        // There are 8 images in the image list
            photos.InsertItem(&lvi);
            // Set subitem 1
            cheminPhoto.Format(_T("%d"), 10*num);
            lvi.iSubItem =1;
            lvi.pszText = (LPTSTR)(LPCTSTR)(cheminPhoto);
            photos.SetItem(&lvi);
            // Set subitem 2
            cheminPhoto.Format(_T("%s"),
            COleDateTime::GetCurrentTime().Format(_T("Created: %I:%M:%S %p, %m/%d/%Y")));
            lvi.iSubItem =2;
            lvi.pszText = (LPTSTR)(LPCTSTR)(cheminPhoto);
            photos.SetItem(&lvi);
            //photos.InsertItem(LVIF_TEXT|LVIF_STATE|LVIF_IMAGE, num, cheminPhoto,0, 0,0, 0);
 
            //incrémentation de num pour la numérotation automatique des photos.
            num++;
        }
    }
}

Quelqu'un peut m'aider svp ?