Home > Software engineering >  Duilib compiled with a prompt say undefined HANDLE hFile, move the red font part behind the CreateFi
Duilib compiled with a prompt say undefined HANDLE hFile, move the red font part behind the CreateFi

Time:09-18

while (! PData)
{
//read less than pictures, directly to read bitmap. M_lpstr directed path
HANDLE hFile=: : CreateFile (pstrGifPath GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, \
FILE_ATTRIBUTE_NORMAL, NULL);
If (hFile==INVALID_HANDLE_VALUE) break;
DwSize=: : GetFileSize (hFile, NULL);
If (dwSize==0) break;

DWORD dwRead=0;
PData=https://bbs.csdn.net/topics/new BYTE [dwSize];
: : ReadFile (hFile, pData, dwSize, & amp; DwRead, NULL);
: : CloseHandle (hFile);

If (dwRead! DwSize)={
The delete [] pData;
PData=https://bbs.csdn.net/topics/NULL;
}
break;
}
if (! PData)
{
return NULL;
}

Gdiplus: : the Image * pImage=LoadGifFromMemory (pData, dwSize);
The delete [] pData;
Return pImage;
}
  • Related