LoadPictureFile

michelmt Messages postés 15 Date d'inscription dimanche 19 janvier 2003 Statut Membre Dernière intervention 16 mai 2004 - 26 déc. 2003 à 23:59
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019 - 27 déc. 2003 à 00:09
Allo !

J'ai fait un programme (boite de dialog) avec MFC
et dans ce programme je lui demande de mettre une image en JPG avec

void myUtilities::RenderPic(CDialog* pDlg, HDC hDC, LPPICTURE pPic, long lx, long ly)
-------------------------
photo ="chat";
myUtilities::LoadPictureFile(".\\images\"+photo+".jpg", pic);
---------------------------
myUtilities::RenderPic(this, dc.m_hDC, pic, 500, 30);
-----------
tout va bien MAIS si il ne trouve pas la photo sa plante !.

Comment lui faire vérifier si elle exite , genre (si oui ..../si non prendre la photo initial) ?

M.T.

1 réponse

BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
27 déc. 2003 à 00:09
BOOL FileExists(const char* pszfl)
{
WIN32_FIND_DATA wfd;
HANDLE hfl = FindFirstFile(pszfl, &wfd);
if(hfl == INVALID_HANDLE_VALUE) return 0;
FindClose(hfl); return 1;
}

BruNews, ciao...
0
Rejoignez-nous