CListCtrl展示jpg图片,但有的jpg图片能显示,有的jpg图片不能显示

CListCtrl显示jpg图片,但有的jpg图片能显示,有的jpg图片不能显示?
在OnInitDialog()中代码是这样的:
C/C++ code

///////图片浏览器的初始化////////////////
    //////////////////////////
    GdiplusStartupInput gdiplusStartupInput;       
         GdiplusStartup( &m_gdiplusToken,&gdiplusStartupInput,NULL );
    m_pImageList=new CImageList;
    m_pImageList->Create(140,140,ILC_COLOR32|ILC_MASK,200,200);
    m_picList.SetImageList(m_pImageList,TVSIL_NORMAL );



这是实现部分:
C/C++ code

void Ctrain13_Dlg::OnBnClickedButton1()//按下按钮,进入文件夹窗口导入图片
{
  OnShowPicture();
}
void Ctrain13_Dlg::OnShowPicture() //获得文件路径名并显示图片
{
    

    char buf[MAX_PATH] = {0};
    if (select_folder(buf))
    {

                
        m_strFileName=buf;
        
        
        LoadImageToList(buf);
    }
}

int select_folder(char path[MAX_PATH],char *title="请选择目录...")//选择文件夹
{
    BROWSEINFO bi;
    ITEMIDLIST *pidl;

    bi.hwndOwner=NULL;
    bi.pidlRoot=NULL;
    bi.pszDisplayName=path;
    bi.lpszTitle=title;
    bi.ulFlags=BIF_EDITBOX;
    bi.lpfn=NULL;
    bi.lParam=0;
    bi.iImage=0;

    pidl=SHBrowseForFolder(&bi);
    return (pidl && SHGetPathFromIDList(pidl,path));
}


BOOL Ctrain13_Dlg::LoadImageToList(CString strFilePathName)//将jpg文件加载到控件m_picList上
{
    int m;
    for(m=m_picList.GetItemCount();m>=0;m--)
        {
            m_picList.DeleteItem(m);
            m_pImageList->Remove(m);
        }
    

    m_picList.SetRedraw(FALSE);
    CFileFind ff;
    CString szDir = strFilePathName;
    CString strSize = _T("");
    CString getextention;
    if(szDir.Right(1) != "\\")
         szDir += "\\";
     szDir += "*.*";

    BOOL res = ff.FindFile(szDir);

    int i=0;
    while(res)
    {
        res = ff.FindNextFile();
        
        if(!ff.IsDirectory() && !ff.IsDots()) // 文件
        {
        //    getextention=ff.Right(foundFileName.GetLength()-foundFileName.ReverseFind('.')-1);//获得文件的后缀名
            CString strFileName = ff.GetFileName();
            getextention=strFileName.Right(strFileName.GetLength()-strFileName.ReverseFind('.')-1);//获得文件的后缀名
            //AfxMessageBox(strFileName);
            if(getextention=="jpg"||getextention=="JPG")
            {
                
                m_strImageName = strFilePathName + _T("\\") +strFileName; 
            
            
                m_picList.InsertItem(i,strFileName,i);//插入名字
                
                LoadBitmapToList(m_strImageName,i++);//读取图片
            }
        }
        
    }


    m_picList.SetRedraw(TRUE);
    m_picList.Invalidate();
    m_picList.UpdateWindow();
    
    
    return true;
}
BOOL Ctrain13_Dlg::LoadBitmapToList(CString strFileName,int i)//使用GDI+加载jpg文件
{


    Bitmap bmp(strFileName.AllocSysString());  
    int sourceWidth = 140;                                           
    int sourceHeight = 140;                 //获得图片宽度                                  
    Bitmap* pThumbnail =(Bitmap*)bmp.GetThumbnailImage(sourceWidth , sourceHeight , NULL, NULL); //设定缩略图的大小
    HBITMAP hBmp;
    pThumbnail->GetHBITMAP(Color(255,255,255),&hBmp );
    CBitmap *pImage = CBitmap::FromHandle(hBmp);         //转换成CBitmap格式位图
    int a=m_pImageList->Add(pImage,RGB(255,255,255));
    pImage->DeleteObject();

    
    return true;
}
void Ctrain13_Dlg::OnShowPicture() //获得文件路径名
{
    

    char buf[MAX_PATH] = {0};
    if (select_folder(buf))
    {

        //AfxMessageBox(buf);
        
        m_strFileName=buf;
        
        
        LoadImageToList(buf);
        //UpdateData(FALSE);
    }
//    GetDlgItem(IDC_EDIT_PATH)->SetWindowText(m_Path);    
}



------解决方案--------------------
你得Debug下看看LoadBitmapToList是否成功加载jpg文件了