>Thanks Gregory and Tore,
>
>Gregory's one is guarantee all picture types. I think so you copied that from your libraries. I made some corrections (TRUE,FALSE,T_CHARACTER)
Yes, Metin. I'm used to including foxpro.h and have TRUE and FALSE defined in my include file
I did not take it from my library. Just thought that stretch = 0, would set the width/height for valid picture files and leave them 0 for unvalid ones
#define TRUE .t.
#define FALSE .f.
#define T_CHARACTER 'C'
>>>Hi All,
>>>I was looking for extension "JPG", "BMP", "GIF" for picture files but VFP supports a lot of picture types now.
>>>
>>>I think so a function should like IfPictureFile() for check a file if it is an image file which VFP can show. How can I do that?
>>
>>Metin
>>
>>Try this. If you use it often, you may want to add an image object to _screen and use that instead of the creating the image object al over
>>
>>
>>function PictureFile(FileName)
>>
>> local Success
>> Success = TRUE
>>
>> do case
>> case !m.Success
>>
>> case !inlist(vartype(m.FileName), T_CHARACTER)
>> Success = FALSE
>>
>> otherwise
>> with createobject('image')
>>
>> .height = 0
>> .width = 0
>> .Stretch = 0
>> .Picture = m.FileName
>>
>> Success = !empty(.height) and !empty(.width)
>>
>> endwith
>>
>> endcase
>>
>> return m.Success
>>
>>endfunc
>>
Gregory