看到msdn中有个函数是DWORD GetFileSize(
HANDLE hFile, // handle to file
LPDWORD lpFileSizeHigh // high-order word of file size
);
但不知道如何得到那个hFile啊?
还有别的好的解决方法吗?多谢
HANDLE hFile, // handle to file
LPDWORD lpFileSizeHigh // high-order word of file size
);
但不知道如何得到那个hFile啊?
还有别的好的解决方法吗?多谢
DWORD dwSize; hHandle = ::CreateFile((LPCTSTR)strZipfile,GENERIC_READ,
FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,
NULL);
if(hHandle == INVALID_HANDLE_VALUE)
return FALSE;
dwSize = ::GetFileSize(hHandle,NULL);
CloseHandle(hHandle);
int nFileSize=0;
CFileFind finder;
if(finder.FindFile(szFile)){
finder.FindNextFile();
nFileSize = finder.GetLength(); //文件大小在这里
finder.Close();
}
sf.GetLength();
非常方便
DWORD dwLen=0;
hFile = CreateFile(strFilePathName, GENERIC_READ, FILE_SHARE_READ, NULL,OPEN_EXISTING, 0, NULL);
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwLen = GetFileSize(hFile, NULL);
}