Re: File Compressed or not?
Hi Giovanni,
Thanks for your prompt response. The input parameter of IsFileCompressed
function is "COMPLETE FILE PATH".
code snippet:
//strFilePath = "C:\\Test\\CompressedFile.jpg or C:\\Test\\NotCompressed.txt
BOOL IsCompressed(CString strFilePath)
{
CFileFind objFileFind;
BOOL bWorking = objFileFind.FindFile(strFilePath);
BOOL bResult = FALSE;
while(bWorking){
bWorking = objFileFind.FindNextFile();
if ((bResult = objFileFind.IsCompressed()))
AfxMessageBox(TEXT("It is compressed file"));
else
AfxMessageBox(TEXT("It is NOT compressed file"));
}//end of while
objFileFind.Close();
return bResult; //It returns always false only
}
void CFileFindDlg::OnOK()
{
BOOL bCompressed = FALSE;
bCompressed = IsFileCompressed(TEXT("E:\\Test\\1.txt"));
//false returned. success
bCompressed = IsFileCompressed(TEXT("E:\\Test\\2.jpg"));
//Here also false returned. failed.
}
Thanks in advance.
--
Thanks & Regards,
Alex.
"Giovanni Dicanio" wrote:
"Alex" <Alex@discussions.microsoft.com> ha scritto nel messaggio
news:74F1039A-BE75-4A3A-BC21-3510DF14A8D7@microsoft.com...
How to find a particular file is compressed or not? I tried with
FindFirstFile API. It always returns 32 as dwFileAttributes only. And
IsCompressed() of CFileFind. I couldn't success here also.
We would give better help if you post some source code to diagnose.
For example, do you call FindNextFile() before calling IsCompressed() ?
However, something like this should work:
<code>
// File finder helper object
CFileFind finder;
// Start finding process
BOOL working = finder.FindFile( path );
// Working loop
while ( working )
{
// You must call FindNextFile *before* calling
// IsCompressed()
working = finder.FindNextFile();
if (finder.IsCompressed())
{
// The file is compressed
...
}
} // while ( working )
</code>
Giovanni