Archive: get the size for image files.....


get the size for image files.....
Hi,

I want to get the size of .png files..... GetFileSize gives the size of .dll,.exe but gives 0 kb for .png files.....plzz help....
thnx in advance..!!!


GetFileSize always gives the file size, no matter what file type it is. If you get zero, then probably the file doesn't exist or it's of zero size. Or maybe it's locked and can't be opened.


This works ok, in my XP box:


Name "png_size"
OutFile "png_size.exe"
ShowInstDetails show

Function FileSizeNew

Exch $0
Push $1
FileOpen $1 $0 "r"
FileSeek $1 0 END $0
FileClose $1
Pop $1
Exch $0

FunctionEnd

Section -
Push "C:\joel\sshot-1.png"
call FileSizeNew
Pop $0
DetailPrint "$0 bytes"
SectionEnd

But, I notice when using like this:
Returns this:

Section -
Push "C:\joel\Mis imágenes\sshot-1.png"
call FileSizeNew
Pop $0
DetailPrint "$0 bytes"
SectionEnd

C:\joel\Mis imágenes\sshot-1.png bytes
Completed
Bug?

FileSizeNew wiki.

Hmm. I use that function with spaces without trouble. Perhaps the accent on imagines is causing the problem? Try the unicode build.