Hi All,

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.The input of this
module is complete file path. Is there any way to find whether it is
compressed or not?


--
Thanks & Regards,
Alex.

Re: File Compressed or not? by Giovanni

Giovanni
Thu Jan 03 03:55:51 CST 2008


"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



Re: File Compressed or not? by Alex

Alex
Thu Jan 03 07:50:01 CST 2008

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
>
>
>

Re: File Compressed or not? by Alexander

Alexander
Thu Jan 03 22:32:35 CST 2008

GetFileAttributes(), check for FILE_ATTRIBUTE_COMPRESSED.

"Alex" <Alex@discussions.microsoft.com> wrote in message
news:74F1039A-BE75-4A3A-BC21-3510DF14A8D7@microsoft.com...
> Hi All,
>
> 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.The input of
> this
> module is complete file path. Is there any way to find whether it is
> compressed or not?
>
>
> --
> Thanks & Regards,
> Alex.



Re: File Compressed or not? by Alex

Alex
Fri Jan 04 01:22:00 CST 2008

Hi Alexander Grigoriev,

Thank you for your response.

DWORD dwFileAttributes = GetFileAttributes(TEXT("E:\\Test\\2.jpg"));

dwFileAttributes always 32 only for jpg or txt files like FindFirstFile
API.

Any idea?

--
Thanks & Regards,
Alex.


"Alexander Grigoriev" wrote:

> GetFileAttributes(), check for FILE_ATTRIBUTE_COMPRESSED.
>
> "Alex" <Alex@discussions.microsoft.com> wrote in message
> news:74F1039A-BE75-4A3A-BC21-3510DF14A8D7@microsoft.com...
> > Hi All,
> >
> > 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.The input of
> > this
> > module is complete file path. Is there any way to find whether it is
> > compressed or not?
> >
> >
> > --
> > Thanks & Regards,
> > Alex.
>
>
>

Re: File Compressed or not? by Giovanni

Giovanni
Fri Jan 04 03:32:37 CST 2008


"Alex" <Alex@discussions.microsoft.com> ha scritto nel messaggio
news:B9087220-9895-4F10-B94C-488C19560803@microsoft.com...
<