Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 6 - Getting at hidden picture information 10

Status
Not open for further replies.

eric43

Programmer
Apr 29, 2005
94
AU
If you right click an image in Explorer and go to 'Properties' there are 3 tabs. If you are lucky the summary tag screen will contain a mess of details about the image - obviously stored by the camera.

Is there a way to access this information on an image file via VFP?

Thanks

Eric

 
Hi Eric,

I'm assuming you are after things like the size (in pixels) and other file specific information.

Try downloading the image file from the camera, onto a hard disc on your machine - then use Explorer to see the properies. You *should* find that they are still visible - i.e. not stored in the camera, but in the file itself.

Now all you need to do is read the file in binary for (as Explorer does for files it recognises - such as JPG etc).

After that, you need to know a fair bit about the file format for JPG files - which I don't! - but this is not so bad, as some kind soul has done the bulk of the hard work for you here:


Albeit in VB (not VFP), but that shouldn't be too hard to convert.

Good luck

Martin

Regards

Griff
Keep [Smile]ing
 
Isn't this know as the EXIF information? I know there are ActiveXs out there for reading that info ( if you don't mind apending the money!!). Do a google on "EXIF ACTIVEX"

Neil

I like work. It fascinates me. I can sit and look at it for hours...
 
eric43

You can use WIA (Windows image acquisition)

Code:
Img = CreateObject("WIA.ImageFile")
Img.LoadFile ("C:WINDOWS\Web\WallpaperBliss.bmp")
s = "Width = " + TRANSFORM(Img.Width) + chr(13) + ;
    "Height = " + TRANSFORM(Img.Height) + chr(13) + ;
    "Depth = " + TRANSFORM(Img.PixelDepth) + chr(13) + ;
    "HorizontalResolution = " + TRANSFORM(Img.HorizontalResolution) + chr(13) + ;
    "VerticalResolution = " + TRANSFORM(Img.VerticalResolution) + chr(13) + ;
    "FrameCount = " + TRANSFORM(Img.FrameCount) + chr(13)
If Img.IsIndexedPixelFormat 
    s = s + "Pixel data contains palette indexes" + chr(13)
EndIf
If Img.IsAlphaPixelFormat
    s = s + "Pixel data has alpha information" + chr(13)
EndIf
If Img.IsExtendedPixelFormat 
    s = s + "Pixel data has extended color information (16 bit/channel)" + chr(13)
EndIf
If Img.IsAnimated 
    s = s + "Image is animated" + chr(13)
EndIf
If Img.Properties.Exists("40091") 
            v = Img.Properties("40091").Value
    s = s + "Title = " + v.String + chr(13)
EndIf
If Img.Properties.Exists("40092") 
            v = Img.Properties("40092").Value
    s = s + "Comment = " + v.String + chr(13)
EndIf
If Img.Properties.Exists("40093") 
            v = Img.Properties("40093").Value
    s = s + "Author = " + v.String + chr(13)
EndIf
If Img.Properties.Exists("40094") 
            v = Img.Properties("40094").Value
    s = s + "Keywords = " + v.String + chr(13)
EndIf
If Img.Properties.Exists("40095") 
            v = Img.Properties("40095").Value
    s = s + "Subject = " + v.String + chr(13)
EndIf
MESSAGEBOX( s)

You can find more information on WIA here (sorry its french)







Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
I'm already using the code U provided before Mike and it works well - but of course there is a heap of other information in a digicam file.

It seems that different cameras start there information at a different byte in the image file header.

Someone may want to try the following form with a letter drop down for the search letter - then an edit box with the cleaned up image header - then a text box with the
byte number of the found chr instances then a drop down with the strings found. FWIW

Code:
** Form : frmimagdata
**********************************************************************
frmimagdata ***  Form1
PROCEDURE Load

PUBLIC search_chr
ENDPROC
** procedure end ***************************************************



frmimagdata ***  Combo1
PROCEDURE InteractiveChange
search_chr = this.value
*!*	SET step on
Delete FILE points.txt
PUBLIC ARRAY aMyStrlist[1]

myworkfile = getfile()
thisform.label1.caption = myworkfile
myfile=filetostr(myworkfile )

mynewstring = ''
N = 1
a = 1
DO while !eof()

	mystring = ASC(subst(myfile,n,1))

	IF mystring < 32 OR mystring > 126
		mychar = chr(128)
		K =1
	ELSE
		mychar = subst(myfile,n,1)
		K = 1
		IF mychar = search_chr

			STRTOFILE(transform(n)+ chr(10),'points.txt',.t.)

		ENDIF

	ENDIF
	N = n + 1
	IF n = 1000
		EXIT
	ENDIF
ENDDO



newline = subst(myfile,159,25)
aMyStrlist(a) = newline
a= a +1
DIMENSION aMyStrlist(a)
newline = subst(myfile,179,25)
aMyStrlist(a) = newline
a= a +1
DIMENSION aMyStrlist(a)
newline = subst(myfile,213,25)
aMyStrlist(a) = newline
a= a +1
DIMENSION aMyStrlist(a)


myfile2 = filetostr('points.txt')



thisform.edit1.value = mynewstring
thisform.text1.value = myfile2
thisform.combo1.value = aMyStrlist

ENDPROC
** procedure end ***************************************************



frmimagdata ***  Combo1
PROCEDURE Init
PUBLIC ARRAY aMyChrlist[1]

a = 1
FOR n = 65 to 90

	aMyChrlist(a) = chr(n)
	a= a +1
	DIMENSION aMyChrlist(a)

ENDFOR

ENDPROC
** procedure end ***************************************************



**********************************************************************
** End of form procedures....: frmimagdata

So I hope someone can throw some light on the mystery

- where is the

 
Hi Eric,

Cut-n-paste the following code into a PRG and execute it. If will prompt you to select an image file and then display the properties GDI+ can retrieve into a grid. Hopefully this will give you what you're looking for. NOTE: This example relies on the _gdiplus.vcx that comes with Visual FoxPro.

Code:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	Top = 0
	Left = 17
	Height = 350
	Width = 400
	DoCreate = .T.
	Caption = "Get Image Properties (EXIF)"
	Name = "Form1"

	ADD OBJECT grid1 AS grid WITH ;
		Anchor = 14, ;
		Height = 351, ;
		Left = 0, ;
		Top = 0, ;
		Width = 400, ;
		Name = "Grid1"

	PROCEDURE createpropertycursor
		CREATE CURSOR crsProps (PropName C(50), IDValue I)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsVer", 0x0000)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsLatitudeRef", 0x0001)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsLatitude", 0x0002)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsLongitudeRef", 0x0003)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsLongitude", 0x0004)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsAltitudeRef", 0x0005)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsAltitude", 0x0006)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsGpsTime", 0x0007)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsGpsSatellites", 0x0008)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsGpsStatus", 0x0009)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsGpsMeasureMode", 0x000A)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsGpsDop", 0x000B)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsSpeedRef", 0x000C)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsSpeed", 0x000D)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsTrackRef", 0x000E)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsTrack", 0x000F)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsImgDirRef", 0x0010)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsImgDir", 0x0011)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsMapDatum", 0x0012)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsDestLatRef", 0x0013)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsDestLat", 0x0014)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsDestLongRef", 0x0015)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsDestLong", 0x0016)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsDestBearRef", 0x0017)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsDestBear", 0x0018)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsDestDistRef", 0x0019)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsDestDist", 0x001A)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagNewSubfileType", 0x00FE)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagSubfileType", 0x00FF)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagImageWidth", 0x0100)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagImageHeight", 0x0101)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagBitsPerSample", 0x0102)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagCompression", 0x0103)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPhotometricInterp", 0x0106)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThreshHolding", 0x0107)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagCellWidth", 0x0108)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagCellHeight", 0x0109)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagFillOrder", 0x010A)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagDocumentName", 0x010D)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagImageDescription", 0x010E)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagEquipMake", 0x010F)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagEquipModel", 0x0110)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagStripOffsets", 0x0111)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagOrientation", 0x0112)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagSamplesPerPixel", 0x0115)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagRowsPerStrip", 0x0116)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagStripBytesCount", 0x0117)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagMinSampleValue", 0x0118)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagMaxSampleValue", 0x0119)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagXResolution", 0x011A)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagYResolution", 0x011B)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPlanarConfig", 0x011C)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPageName", 0x011D)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagXPosition", 0x011E)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagYPosition", 0x011F)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagFreeOffset", 0x0120)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagFreeByteCounts", 0x0121)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGrayResponseUnit", 0x0122)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGrayResponseCurve", 0x0123)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagT4Option", 0x0124)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagT6Option", 0x0125)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagResolutionUnit", 0x0128)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPageNumber", 0x0129)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagTransferFunction", 0x012D)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagSoftwareUsed", 0x0131)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagDateTime", 0x0132)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagArtist", 0x013B)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagHostComputer", 0x013C)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPredictor", 0x013D)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagWhitePoint", 0x013E)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPrimaryChromaticities", 0x013F)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagColorMap", 0x0140)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagHalftoneHints", 0x0141)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagTileWidth", 0x0142)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagTileLength", 0x0143)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagTileOffset", 0x0144)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagTileByteCounts", 0x0145)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagInkSet", 0x014C)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagInkNames", 0x014D)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagNumberOfInks", 0x014E)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagDotRange", 0x0150)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagTargetPrinter", 0x0151)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExtraSamples", 0x0152)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagSampleFormat", 0x0153)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagSMinSampleValue", 0x0154)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagSMaxSampleValue", 0x0155)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagTransferRange", 0x0156)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagJPEGProc", 0x0200)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagJPEGInterFormat", 0x0201)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagJPEGInterLength", 0x0202)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagJPEGRestartInterval", 0x0203)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagJPEGLosslessPredictors", 0x0205)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagJPEGPointTransforms", 0x0206)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagJPEGQTables", 0x0207)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagJPEGDCTables", 0x0208)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagJPEGACTables", 0x0209)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagYCbCrCoefficients", 0x0211)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagYCbCrSubsampling", 0x0212)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagYCbCrPositioning", 0x0213)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagREFBlackWhite", 0x0214)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGamma", 0x0301)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagICCProfileDescriptor", 0x0302)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagSRGBRenderingIntent", 0x0303)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagImageTitle", 0x0320)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagResolutionXUnit", 0x5001)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagResolutionYUnit", 0x5002)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagResolutionXLengthUnit", 0x5003)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagResolutionYLengthUnit", 0x5004)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPrintFlags", 0x5005)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPrintFlagsVersion", 0x5006)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPrintFlagsCrop", 0x5007)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPrintFlagsBleedWidth", 0x5008)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPrintFlagsBleedWidthScale", 0x5009)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagHalftoneLPI", 0x500A)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagHalftoneLPIUnit", 0x500B)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagHalftoneDegree", 0x500C)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagHalftoneShape", 0x500D)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagHalftoneMisc", 0x500E)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagHalftoneScreen", 0x500F)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagJPEGQuality", 0x5010)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGridSize", 0x5011)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailFormat", 0x5012)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailWidth", 0x5013)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailHeight", 0x5014)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailColorDepth", 0x5015)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailPlanes", 0x5016)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailRawBytes", 0x5017)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailSize", 0x5018)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailCompressedSize", 0x5019)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagColorTransferFunction", 0x501A)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailData", 0x501B)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailImageWidth", 0x5020)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailImageHeight", 0x5021)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailBitsPerSample", 0x5022)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailCompression", 0x5023)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailPhotometricInterp", 0x5024)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailImageDescription", 0x5025)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailEquipMake", 0x5026)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailEquipModel", 0x5027)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailStripOffsets", 0x5028)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailOrientation", 0x5029)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailSamplesPerPixel", 0x502A)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailRowsPerStrip", 0x502B)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailStripBytesCount", 0x502C)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailResolutionX", 0x502D)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailResolutionY", 0x502E)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailPlanarConfig", 0x502F)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailResolutionUnit", 0x5030)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailTransferFunction", 0x5031)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailSoftwareUsed", 0x5032)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailDateTime", 0x5033)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailArtist", 0x5034)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailWhitePoint", 0x5035)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailPrimaryChromaticities", 0x5036)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailYCbCrCoefficients", 0x5037)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailYCbCrSubsampling", 0x5038)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailYCbCrPositioning", 0x5039)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailRefBlackWhite", 0x503A)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagThumbnailCopyRight", 0x503B)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagLuminanceTable", 0x5090)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagChrominanceTable", 0x5091)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagFrameDelay", 0x5100)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagLoopCount", 0x5101)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGlobalPalette", 0x5102)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagIndexBackground", 0x5103)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagIndexTransparent", 0x5104)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPixelUnit", 0x5110)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPixelPerUnitX", 0x5111)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPixelPerUnitY", 0x5112)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagPaletteHistogram", 0x5113)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagCopyright", 0x8298)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifExposureTime", 0x829A)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifFNumber", 0x829D)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifIFD", 0x8769)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagICCProfile", 0x8773)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifExposureProg", 0x8822)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifSpectralSense", 0x8824)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagGpsIFD", 0x8825)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifISOSpeed", 0x8827)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifOECF", 0x8828)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifVer", 0x9000)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifDTOrig", 0x9003)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifDTDigitized", 0x9004)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifCompConfig", 0x9101)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifCompBPP", 0x9102)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifShutterSpeed", 0x9201)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifAperture", 0x9202)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifBrightness", 0x9203)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifExposureBias", 0x9204)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifMaxAperture", 0x9205)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifSubjectDist", 0x9206)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifMeteringMode", 0x9207)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifLightSource", 0x9208)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifFlash", 0x9209)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifFocalLength", 0x920A)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifMakerNote", 0x927C)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifUserComment", 0x9286)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifDTSubsec", 0x9290)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifDTOrigSS", 0x9291)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifDTDigSS", 0x9292)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifFPXVer", 0xA000)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifColorSpace", 0xA001)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifPixXDim", 0xA002)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifPixYDim", 0xA003)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifRelatedWav", 0xA004)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifInterop", 0xA005)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifFlashEnergy", 0xA20B)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifSpatialFR", 0xA20C)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifFocalXRes", 0xA20E)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifFocalYRes", 0xA20F)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifFocalResUnit", 0xA210)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifSubjectLoc", 0xA214)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifExposureIndex", 0xA215)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifSensingMethod", 0xA217)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifFileSource", 0xA300)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifSceneType", 0xA301)
		INSERT INTO crsProps (PropName, IDValue) values("PropertyTagExifCfaPattern", 0xA302)
		INDEX ON IDValue TO IDValue
	ENDPROC

	PROCEDURE retrievepropname
		LPARAMETERS tnPropertyID
		LOCAL lcReturn
		lcReturn = "Unknown"
		IF SEEK(tnPropertyID, "crsProps", "IDValue")
			lcReturn = crsProps.PropName
		ENDIF
		RETURN lcReturn
	ENDPROC

	PROCEDURE getimageproperties
		LOCAL lnMax
		DIMENSION aryProps(1)
		aryProps(1) = NULL
		WITH this
			lnMax = .GpImage1.GetPropertyIDList(@aryProps)
			CREATE CURSOR crsEXIF (Property c(50), Data c(100))
			FOR lnCounter = 1 TO lnMax
				INSERT INTO crsEXIF (Property, Data) VALUES (.RetrievePropName(aryProps(lnCounter)), TRANSFORM(.GpImage1.GetPropertyItem(aryProps(lnCounter))))
			ENDFOR
			GO TOP IN crsEXIF
		ENDWITH
	ENDPROC

	PROCEDURE fillpropertygrid
		WITH this
			.createpropertycursor()
			.getimageproperties()
			.grid1.RecordSource = "crsEXIF"
			.grid1.Refresh()
			.grid1.AutoFit()
		ENDWITH
	ENDPROC

	PROCEDURE Init
		LOCAL lcImageFile
		lcImageFile = GETPICT()
		IF EMPTY(lcImageFile)
		  RETURN .F.
		ENDIF
		IF !("_GDIPLUS" $ SET("Classlib"))
			SET CLASSLIB TO LOCFILE(HOME(1) + "FFC\_gdiplus.vcx", "VCX", "Select _gdiplus.vcx")
		ENDIF
		THIS.ADDOBJECT("gpImage1", "gpImage", lcImageFile, .F.)
		THIS.fillpropertygrid()
	ENDPROC

	PROCEDURE Destroy
		USE IN SELECT("crsProps")
		USE IN SELECT("crsEXIF")
	ENDPROC

ENDDEFINE

boyd.gif

SweetPotato Software Website
My Blog
 
Hi Craig,

That's clearly what I would like to do BUT I did say in VFP 6.

I have Gdiplus.dll but not the vcx.

Is there any way I can use this?

many thanks

Eric
 
Eric,

OK, I would like to encourage you to upgrade to VFP9. It's well worth the price of admission. [smile] Having said that, here's the converted code that should work in VFP 6.
Code:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.SHOW
RETURN

DEFINE CLASS form1 AS FORM

	TOP = 0
	LEFT = 17
	HEIGHT = 350
	WIDTH = 400
	DOCREATE = .T.
	CAPTION = "Get Image Properties (EXIF)"
	NAME = "Form1"
	gpImageHandle = 0

	ADD OBJECT grid1 AS GRID WITH ;
		ANCHOR = 14, ;
		HEIGHT = 351, ;
		LEFT = 0, ;
		TOP = 0, ;
		WIDTH = 400, ;
		NAME = "Grid1"

	PROCEDURE createpropertycursor
		CREATE CURSOR crsProps (PropName C(50), IDValue I)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsVer", 0x0000)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsLatitudeRef", 0x0001)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsLatitude", 0x0002)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsLongitudeRef", 0x0003)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsLongitude", 0x0004)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsAltitudeRef", 0x0005)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsAltitude", 0x0006)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsGpsTime", 0x0007)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsGpsSatellites", 0x0008)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsGpsStatus", 0x0009)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsGpsMeasureMode", 0x000A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsGpsDop", 0x000B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsSpeedRef", 0x000C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsSpeed", 0x000D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsTrackRef", 0x000E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsTrack", 0x000F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsImgDirRef", 0x0010)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsImgDir", 0x0011)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsMapDatum", 0x0012)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestLatRef", 0x0013)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestLat", 0x0014)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestLongRef", 0x0015)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestLong", 0x0016)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestBearRef", 0x0017)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestBear", 0x0018)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestDistRef", 0x0019)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestDist", 0x001A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagNewSubfileType", 0x00FE)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSubfileType", 0x00FF)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagImageWidth", 0x0100)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagImageHeight", 0x0101)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagBitsPerSample", 0x0102)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagCompression", 0x0103)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPhotometricInterp", 0x0106)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThreshHolding", 0x0107)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagCellWidth", 0x0108)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagCellHeight", 0x0109)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagFillOrder", 0x010A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagDocumentName", 0x010D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagImageDescription", 0x010E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagEquipMake", 0x010F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagEquipModel", 0x0110)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagStripOffsets", 0x0111)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagOrientation", 0x0112)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSamplesPerPixel", 0x0115)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagRowsPerStrip", 0x0116)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagStripBytesCount", 0x0117)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagMinSampleValue", 0x0118)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagMaxSampleValue", 0x0119)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagXResolution", 0x011A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagYResolution", 0x011B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPlanarConfig", 0x011C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPageName", 0x011D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagXPosition", 0x011E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagYPosition", 0x011F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagFreeOffset", 0x0120)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagFreeByteCounts", 0x0121)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGrayResponseUnit", 0x0122)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGrayResponseCurve", 0x0123)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagT4Option", 0x0124)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagT6Option", 0x0125)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagResolutionUnit", 0x0128)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPageNumber", 0x0129)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTransferFunction", 0x012D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSoftwareUsed", 0x0131)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagDateTime", 0x0132)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagArtist", 0x013B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHostComputer", 0x013C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPredictor", 0x013D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagWhitePoint", 0x013E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrimaryChromaticities", 0x013F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagColorMap", 0x0140)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneHints", 0x0141)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTileWidth", 0x0142)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTileLength", 0x0143)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTileOffset", 0x0144)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTileByteCounts", 0x0145)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagInkSet", 0x014C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagInkNames", 0x014D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagNumberOfInks", 0x014E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagDotRange", 0x0150)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTargetPrinter", 0x0151)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExtraSamples", 0x0152)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSampleFormat", 0x0153)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSMinSampleValue", 0x0154)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSMaxSampleValue", 0x0155)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTransferRange", 0x0156)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGProc", 0x0200)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGInterFormat", 0x0201)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGInterLength", 0x0202)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGRestartInterval", 0x0203)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGLosslessPredictors", 0x0205)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGPointTransforms", 0x0206)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGQTables", 0x0207)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGDCTables", 0x0208)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGACTables", 0x0209)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagYCbCrCoefficients", 0x0211)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagYCbCrSubsampling", 0x0212)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagYCbCrPositioning", 0x0213)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagREFBlackWhite", 0x0214)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGamma", 0x0301)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagICCProfileDescriptor", 0x0302)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSRGBRenderingIntent", 0x0303)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagImageTitle", 0x0320)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagResolutionXUnit", 0x5001)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagResolutionYUnit", 0x5002)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagResolutionXLengthUnit", 0x5003)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagResolutionYLengthUnit", 0x5004)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrintFlags", 0x5005)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrintFlagsVersion", 0x5006)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrintFlagsCrop", 0x5007)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrintFlagsBleedWidth", 0x5008)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrintFlagsBleedWidthScale", 0x5009)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneLPI", 0x500A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneLPIUnit", 0x500B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneDegree", 0x500C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneShape", 0x500D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneMisc", 0x500E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneScreen", 0x500F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGQuality", 0x5010)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGridSize", 0x5011)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailFormat", 0x5012)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailWidth", 0x5013)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailHeight", 0x5014)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailColorDepth", 0x5015)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailPlanes", 0x5016)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailRawBytes", 0x5017)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailSize", 0x5018)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailCompressedSize", 0x5019)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagColorTransferFunction", 0x501A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailData", 0x501B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailImageWidth", 0x5020)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailImageHeight", 0x5021)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailBitsPerSample", 0x5022)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailCompression", 0x5023)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailPhotometricInterp", 0x5024)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailImageDescription", 0x5025)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailEquipMake", 0x5026)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailEquipModel", 0x5027)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailStripOffsets", 0x5028)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailOrientation", 0x5029)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailSamplesPerPixel", 0x502A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailRowsPerStrip", 0x502B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailStripBytesCount", 0x502C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailResolutionX", 0x502D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailResolutionY", 0x502E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailPlanarConfig", 0x502F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailResolutionUnit", 0x5030)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailTransferFunction", 0x5031)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailSoftwareUsed", 0x5032)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailDateTime", 0x5033)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailArtist", 0x5034)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailWhitePoint", 0x5035)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailPrimaryChromaticities", 0x5036)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailYCbCrCoefficients", 0x5037)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailYCbCrSubsampling", 0x5038)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailYCbCrPositioning", 0x5039)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailRefBlackWhite", 0x503A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailCopyRight", 0x503B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagLuminanceTable", 0x5090)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagChrominanceTable", 0x5091)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagFrameDelay", 0x5100)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagLoopCount", 0x5101)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGlobalPalette", 0x5102)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagIndexBackground", 0x5103)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagIndexTransparent", 0x5104)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPixelUnit", 0x5110)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPixelPerUnitX", 0x5111)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPixelPerUnitY", 0x5112)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPaletteHistogram", 0x5113)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagCopyright", 0x8298)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifExposureTime", 0x829A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFNumber", 0x829D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifIFD", 0x8769)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagICCProfile", 0x8773)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifExposureProg", 0x8822)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSpectralSense", 0x8824)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsIFD", 0x8825)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifISOSpeed", 0x8827)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifOECF", 0x8828)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifVer", 0x9000)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifDTOrig", 0x9003)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifDTDigitized", 0x9004)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifCompConfig", 0x9101)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifCompBPP", 0x9102)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifShutterSpeed", 0x9201)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifAperture", 0x9202)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifBrightness", 0x9203)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifExposureBias", 0x9204)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifMaxAperture", 0x9205)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSubjectDist", 0x9206)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifMeteringMode", 0x9207)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifLightSource", 0x9208)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFlash", 0x9209)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFocalLength", 0x920A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifMakerNote", 0x927C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifUserComment", 0x9286)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifDTSubsec", 0x9290)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifDTOrigSS", 0x9291)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifDTDigSS", 0x9292)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFPXVer", 0xA000)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifColorSpace", 0xA001)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifPixXDim", 0xA002)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifPixYDim", 0xA003)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifRelatedWav", 0xA004)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifInterop", 0xA005)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFlashEnergy", 0xA20B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSpatialFR", 0xA20C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFocalXRes", 0xA20E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFocalYRes", 0xA20F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFocalResUnit", 0xA210)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSubjectLoc", 0xA214)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifExposureIndex", 0xA215)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSensingMethod", 0xA217)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFileSource", 0xA300)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSceneType", 0xA301)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifCfaPattern", 0xA302)
		INDEX ON IDValue TO IDValue
	ENDPROC

	PROCEDURE retrievepropname
		LPARAMETERS tnPropertyID
		LOCAL lcReturn
		lcReturn = "Unknown"
		IF SEEK(tnPropertyID, "crsProps", "IDValue")
			lcReturn = crsProps.PropName
		ENDIF
		RETURN lcReturn
	ENDPROC

	PROCEDURE getimageproperties
		LOCAL lnMax
		DIMENSION aryProps(1)
		aryProps(1) = NULL
		WITH THIS
			lnMax = .GGetPropertyIDList(@aryProps)
			CREATE CURSOR crsEXIF (Property C(50), DATA C(100))
			FOR lnCounter = 1 TO lnMax
				INSERT INTO crsEXIF (Property, DATA) VALUES (.retrievepropname(aryProps(lnCounter)), TRANSFORM(.GGetPropertyItem(aryProps(lnCounter))))
			ENDFOR
			GO TOP IN crsEXIF
		ENDWITH
	ENDPROC

	PROCEDURE fillpropertygrid
		WITH THIS
			.createpropertycursor()
			.getimageproperties()
			.grid1.RECORDSOURCE = "crsEXIF"
			.grid1.REFRESH()
			.grid1.AUTOFIT()
		ENDWITH
	ENDPROC

	PROCEDURE INIT
		LOCAL lcImageFile
		lcImageFile = GETPICT()
		IF EMPTY(lcImageFile)
			RETURN .F.
		ENDIF
		THIS.DeclareAPIs()
		THIS.gpImageHandle = THIS.GGetImageHandle(lcImageFile)
		THIS.fillpropertygrid()
	ENDPROC

	PROCEDURE DESTROY
		USE IN SELECT("crsProps")
		USE IN SELECT("crsEXIF")
	ENDPROC

*************************
	FUNCTION GGetPropertyCount()
*************************
		LOCAL lnCount
		m.lnCount = 0
		GdipGetPropertyCount(THIS.gpImageHandle, @m.lnCount)
		RETURN m.lnCount
	ENDFUNC

*************************
	FUNCTION GGetPropertyIDList(aryPropIDList)
*************************
		LOCAL lnCount, lcIdList, lnIndex
		m.lnCount = THIS.GGetPropertyCount()
		IF ISNULL(m.lnCount) OR m.lnCount < 1
			RETURN m.lnCount
		ENDIF

		m.lcIdList = REPLICATE(CHR(0), 4 * m.lnCount)
		GdipGetPropertyIdList(THIS.gpImageHandle, m.lnCount, @m.lcIdList)

		DIMENSION aryPropIDList(m.lnCount)
		FOR m.lnIndex = 1 TO m.lnCount
			aryPropIDList(m.lnIndex) = THIS.buf2num(SUBSTR(m.lcIdList, m.lnIndex * 4 - 3, 4))
		ENDFOR
		RETURN m.lnCount
	ENDFUNC

*************************
	FUNCTION GGetPropertyItem(tnPropID)
*************************
		LOCAL lnBufferSize, lnBufferPtr, lnStringPtr, ;
			lnPropertyTagType, lnValueLen, lnValuePtr, lvReturn

		m.lnBufferSize = 0

		GdipGetPropertyItemSize(THIS.gpImageHandle, m.tnPropID, @lnBufferSize)

		m.lnBufferPtr = GlobalAlloc(64, m.lnBufferSize)

		IF 0 == m.lnBufferPtr
			RETURN ""
		ENDIF

		GdipGetPropertyItem(THIS.gpImageHandle, m.tnPropID, ;
			m.lnBufferSize, m.lnBufferPtr)

		lnPropertyTagType = THIS.buf2num(THIS.GetMemString(m.lnBufferPtr + 8, 4))
		lnValueLen = THIS.buf2num(THIS.GetMemString(m.lnBufferPtr + 4, 4))
		lnValuePtr = THIS.buf2num(THIS.GetMemString(m.lnBufferPtr + 12, 4))

		DO CASE
			CASE INLIST(m.lnPropertyTagType,0,6,7,8)
				lvReturn = NULL
			CASE 1 == m.lnPropertyTagType
				lvReturn = ASC(THIS.GetMemString(m.lnValuePtr, 1))
			CASE 2 == m.lnPropertyTagType
				lvReturn = STREXTRACT(THIS.GetMemString(m.lnValuePtr, m.lnValueLen),'',CHR(0),1,2)
			CASE 3 == m.lnPropertyTagType
				lvReturn = ASC(THIS.GetMemString(m.lnValuePtr, 1)) + 256 * ASC(THIS.GetMemString(m.lnValuePtr + 1, 1))
			CASE 4 == m.lnPropertyTagType
				lvReturn = THIS.buf2num(THIS.GetMemString(m.lnValuePtr, 4))
			CASE 5 == m.lnPropertyTagType
				lvReturn = LTRIM(STR(THIS.buf2num(THIS.GetMemString(m.lnValuePtr, 4)))) + '/' ;
					+ LTRIM(STR(THIS.buf2num(THIS.GetMemString(m.lnValuePtr + 4, 4))))
			CASE 9 == m.lnPropertyTagType
				lvReturn = THIS.buf2num(THIS.GetMemString(m.lnValuePtr, 4))
				IF m.lvReturn > 2147483647
					lvReturn = m.lvReturn - 4294967296
				ENDIF
			CASE 10 == m.lnPropertyTagType
				LOCAL lnNum, lnDen
				lnNum = THIS.buf2num(THIS.GetMemString(m.lnValuePtr, 4))
				lnDen = THIS.buf2num(THIS.GetMemString(m.lnValuePtr + 4, 4))
				IF m.lnNum > 2147483647
					lnNum = m.lnNum - 4294967296
				ENDIF
				IF m.lnDen >2147483647
					lnDen = m.lnDen - 4294967296
				ENDIF
				lvReturn = LTRIM(STR(m.lnNum)) +'/'+LTRIM(STR(m.lnDen))
			OTHERWISE
				GlobalFree(m.lnBufferPtr)
				RETURN ""
		ENDCASE
		GlobalFree(m.lnBufferPtr)
		RETURN m.lvReturn
	ENDFUNC

*************************
	FUNCTION GGetImageHandle(tcFilename)
*************************
		LOCAL lnHandle
		m.lnHandle = 0
		GdipLoadImageFromFile(STRCONV(m.tcFilename + CHR(0), 5), @m.lnHandle)
		RETURN m.lnHandle
	ENDFUNC

************************
	FUNCTION buf2num(tcBuffer)
************************
		RETURN ASC(SUBSTR(tcBuffer, 1,1)) + ;
			ASC(SUBSTR(tcBuffer, 2,1)) * 2^8 + ;
			ASC(SUBSTR(tcBuffer, 3,1)) * 2^16 + ;
			ASC(SUBSTR(tcBuffer, 4,1)) * 2^24

*************************
	FUNCTION GetMemString(tnString, tnMaxLength)
*************************
		LOCAL lcRet, lnNulfoundAt, lcReturn
		lcReturn = ""
		IF tnString != 0
			lcRet = SPACE(tnMaxLength)
			CopyMemory(@lcRet, tnString, LEN(lcRet))
			lnNulfoundAt = AT(CHR(0), lcRet)
			IF  lnNulfoundAt > 0
				lcRet = LEFT(lcRet, lnNulfoundAt - 1)
			ENDIF
			lcReturn = lcRet
		ENDIF
		RETURN lcReturn
	ENDFUNC

*************************
	PROCEDURE DeclareAPIs()
*************************
		DECLARE INTEGER GdipLoadImageFromFile IN GDIPLUS.DLL ;
			STRING wFilename, INTEGER @ nImage
		DECLARE INTEGER GdipGetPropertyCount IN GDIPLUS.DLL ;
			INTEGER nImage, INTEGER @nCount
		DECLARE INTEGER GdipGetPropertyIdList IN GDIPLUS.DLL ;
			INTEGER nImage, INTEGER nCount, STRING @ LIST
		DECLARE INTEGER GlobalAlloc IN kernel32.DLL ;
			INTEGER nFlags, INTEGER nSize
		DECLARE INTEGER GlobalFree IN kernel32.DLL ;
			INTEGER nHandle
		DECLARE INTEGER lstrlenA IN kernel32.DLL AS __win32_lstrlenA_ptr INTEGER
		DECLARE INTEGER GdipGetPropertyItemSize IN GDIPLUS.DLL ;
			INTEGER nImage, INTEGER nPropID, INTEGER @ nBufSize
		DECLARE INTEGER GdipGetPropertyItem IN GDIPLUS.DLL ;
			INTEGER nImage, INTEGER nPropID, INTEGER nBufSize, INTEGER nBufferPtr
		DECLARE RtlMoveMemory IN kernel32 AS CopyMemory;
			STRING @ Destination, INTEGER SOURCE, INTEGER nLength
	ENDPROC

ENDDEFINE

boyd.gif

SweetPotato Software Website
My Blog
 
Craig,

Thank you very much - there are reasons I'm still with VFP 6.

with the code
Code:
*************************
    FUNCTION GGetImageHandle(tcFilename)
*************************
        LOCAL lnHandle
        m.lnHandle = 0
        GdipLoadImageFromFile(STRCONV(m.tcFilename + CHR(0), 5), @m.lnHandle)
        RETURN m.lnHandle
    ENDFUNC


Unfortunately I get this error on the GdipLoadImageFromFile line

Regards

Eric


Declare DLL call caused an exception
 
Eric,

I seemed to have missed the STRCONV(). Sorry about that. Here is what the equivalent would be in Visual FoxPro 6.0.

Code:
GdipLoadImageFromFile(a2u(m.tcFilename + CHR(0)), @m.lnHandle)

******************************
FUNCTION a2u(cText) 
******************************
*!* [URL unfurl="true"]http://www.news2news.com/vfp/?example=14&function=488[/URL]
******************************
    DECLARE INTEGER WideCharToMultiByte IN kernel32; 
        INTEGER CodePg, INTEGER dwFlags,; 
        STRING lpWideCharStr, INTEGER cchWideChar,; 
        STRING @lpMultiByteStr, INTEGER cbMultiByte,; 
        STRING lpDefaultChar, INTEGER lpUsedDefaultChar 

    DECLARE INTEGER MultiByteToWideChar IN kernel32; 
        INTEGER CodePage, LONG dwFlags, STRING lpMultiByteStr,; 
        INTEGER cbMultiByte, STRING @lpWCharStr, INTEGER cchWChar 
        
    LOCAL lcBuffer, lnBufsize 
     
    * first calling to define required buffer size 
    lcBuffer = "" 
    lnBufsize = MultiByteToWideChar(0, 1,; 
        cText, Len(cText), @lcBuffer, 0) 

    lcBuffer = Repli(Chr(0), lnBufsize*2)  && in wide chars 
    = MultiByteToWideChar(0, 1,; 
        cText, Len(cText), @lcBuffer, lnBufsize) 
RETURN lcBuffer

boyd.gif

SweetPotato Software Website
My Blog
 
Craig,

I now get an error

I renamed the a2u Function for clarity.

vfp declare dll caused an exception

at GdipLoadImageFromFile(stringconvert(m.tcFilename+ CHR(0)), @m.lnHandle)

I've looked at the site U sent and it looks Ok but the parameters being passed are not correct.

Any ideas please?

Eric

 
Craig - oops I see the bracket missing but I still get an error there
 
eric43,

Can you give me more information on the error you are getting (such as the error number, the error message, etc.)? It is always a good idea to provide this sort of information when asking for help with an error. Also, did you make StringConvert() a standalone function or did you add it to the form in the code above? If so then you would need to use this.stringconvert to call it.

To perhaps save us both some time I should have just posted the entire thing with the a2u function integrated into it. So here is the code again:
Code:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.SHOW
RETURN

DEFINE CLASS form1 AS FORM

	TOP = 0
	LEFT = 17
	HEIGHT = 350
	WIDTH = 400
	DOCREATE = .T.
	CAPTION = "Get Image Properties (EXIF)"
	NAME = "Form1"
	gpImageHandle = 0

	ADD OBJECT grid1 AS GRID WITH ;
		ANCHOR = 14, ;
		HEIGHT = 351, ;
		LEFT = 0, ;
		TOP = 0, ;
		WIDTH = 400, ;
		NAME = "Grid1"

*************************
	PROCEDURE createpropertycursor
*************************
		CREATE CURSOR crsProps (PropName C(50), IDValue I)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsVer", 0x0000)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsLatitudeRef", 0x0001)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsLatitude", 0x0002)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsLongitudeRef", 0x0003)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsLongitude", 0x0004)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsAltitudeRef", 0x0005)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsAltitude", 0x0006)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsGpsTime", 0x0007)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsGpsSatellites", 0x0008)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsGpsStatus", 0x0009)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsGpsMeasureMode", 0x000A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsGpsDop", 0x000B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsSpeedRef", 0x000C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsSpeed", 0x000D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsTrackRef", 0x000E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsTrack", 0x000F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsImgDirRef", 0x0010)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsImgDir", 0x0011)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsMapDatum", 0x0012)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestLatRef", 0x0013)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestLat", 0x0014)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestLongRef", 0x0015)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestLong", 0x0016)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestBearRef", 0x0017)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestBear", 0x0018)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestDistRef", 0x0019)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsDestDist", 0x001A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagNewSubfileType", 0x00FE)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSubfileType", 0x00FF)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagImageWidth", 0x0100)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagImageHeight", 0x0101)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagBitsPerSample", 0x0102)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagCompression", 0x0103)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPhotometricInterp", 0x0106)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThreshHolding", 0x0107)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagCellWidth", 0x0108)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagCellHeight", 0x0109)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagFillOrder", 0x010A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagDocumentName", 0x010D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagImageDescription", 0x010E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagEquipMake", 0x010F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagEquipModel", 0x0110)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagStripOffsets", 0x0111)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagOrientation", 0x0112)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSamplesPerPixel", 0x0115)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagRowsPerStrip", 0x0116)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagStripBytesCount", 0x0117)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagMinSampleValue", 0x0118)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagMaxSampleValue", 0x0119)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagXResolution", 0x011A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagYResolution", 0x011B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPlanarConfig", 0x011C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPageName", 0x011D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagXPosition", 0x011E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagYPosition", 0x011F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagFreeOffset", 0x0120)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagFreeByteCounts", 0x0121)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGrayResponseUnit", 0x0122)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGrayResponseCurve", 0x0123)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagT4Option", 0x0124)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagT6Option", 0x0125)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagResolutionUnit", 0x0128)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPageNumber", 0x0129)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTransferFunction", 0x012D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSoftwareUsed", 0x0131)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagDateTime", 0x0132)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagArtist", 0x013B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHostComputer", 0x013C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPredictor", 0x013D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagWhitePoint", 0x013E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrimaryChromaticities", 0x013F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagColorMap", 0x0140)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneHints", 0x0141)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTileWidth", 0x0142)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTileLength", 0x0143)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTileOffset", 0x0144)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTileByteCounts", 0x0145)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagInkSet", 0x014C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagInkNames", 0x014D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagNumberOfInks", 0x014E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagDotRange", 0x0150)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTargetPrinter", 0x0151)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExtraSamples", 0x0152)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSampleFormat", 0x0153)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSMinSampleValue", 0x0154)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSMaxSampleValue", 0x0155)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagTransferRange", 0x0156)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGProc", 0x0200)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGInterFormat", 0x0201)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGInterLength", 0x0202)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGRestartInterval", 0x0203)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGLosslessPredictors", 0x0205)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGPointTransforms", 0x0206)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGQTables", 0x0207)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGDCTables", 0x0208)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGACTables", 0x0209)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagYCbCrCoefficients", 0x0211)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagYCbCrSubsampling", 0x0212)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagYCbCrPositioning", 0x0213)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagREFBlackWhite", 0x0214)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGamma", 0x0301)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagICCProfileDescriptor", 0x0302)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagSRGBRenderingIntent", 0x0303)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagImageTitle", 0x0320)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagResolutionXUnit", 0x5001)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagResolutionYUnit", 0x5002)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagResolutionXLengthUnit", 0x5003)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagResolutionYLengthUnit", 0x5004)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrintFlags", 0x5005)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrintFlagsVersion", 0x5006)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrintFlagsCrop", 0x5007)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrintFlagsBleedWidth", 0x5008)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPrintFlagsBleedWidthScale", 0x5009)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneLPI", 0x500A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneLPIUnit", 0x500B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneDegree", 0x500C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneShape", 0x500D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneMisc", 0x500E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagHalftoneScreen", 0x500F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagJPEGQuality", 0x5010)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGridSize", 0x5011)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailFormat", 0x5012)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailWidth", 0x5013)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailHeight", 0x5014)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailColorDepth", 0x5015)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailPlanes", 0x5016)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailRawBytes", 0x5017)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailSize", 0x5018)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailCompressedSize", 0x5019)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagColorTransferFunction", 0x501A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailData", 0x501B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailImageWidth", 0x5020)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailImageHeight", 0x5021)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailBitsPerSample", 0x5022)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailCompression", 0x5023)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailPhotometricInterp", 0x5024)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailImageDescription", 0x5025)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailEquipMake", 0x5026)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailEquipModel", 0x5027)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailStripOffsets", 0x5028)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailOrientation", 0x5029)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailSamplesPerPixel", 0x502A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailRowsPerStrip", 0x502B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailStripBytesCount", 0x502C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailResolutionX", 0x502D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailResolutionY", 0x502E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailPlanarConfig", 0x502F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailResolutionUnit", 0x5030)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailTransferFunction", 0x5031)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailSoftwareUsed", 0x5032)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailDateTime", 0x5033)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailArtist", 0x5034)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailWhitePoint", 0x5035)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailPrimaryChromaticities", 0x5036)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailYCbCrCoefficients", 0x5037)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailYCbCrSubsampling", 0x5038)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailYCbCrPositioning", 0x5039)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailRefBlackWhite", 0x503A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagThumbnailCopyRight", 0x503B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagLuminanceTable", 0x5090)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagChrominanceTable", 0x5091)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagFrameDelay", 0x5100)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagLoopCount", 0x5101)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGlobalPalette", 0x5102)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagIndexBackground", 0x5103)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagIndexTransparent", 0x5104)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPixelUnit", 0x5110)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPixelPerUnitX", 0x5111)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPixelPerUnitY", 0x5112)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagPaletteHistogram", 0x5113)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagCopyright", 0x8298)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifExposureTime", 0x829A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFNumber", 0x829D)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifIFD", 0x8769)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagICCProfile", 0x8773)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifExposureProg", 0x8822)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSpectralSense", 0x8824)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagGpsIFD", 0x8825)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifISOSpeed", 0x8827)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifOECF", 0x8828)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifVer", 0x9000)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifDTOrig", 0x9003)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifDTDigitized", 0x9004)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifCompConfig", 0x9101)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifCompBPP", 0x9102)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifShutterSpeed", 0x9201)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifAperture", 0x9202)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifBrightness", 0x9203)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifExposureBias", 0x9204)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifMaxAperture", 0x9205)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSubjectDist", 0x9206)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifMeteringMode", 0x9207)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifLightSource", 0x9208)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFlash", 0x9209)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFocalLength", 0x920A)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifMakerNote", 0x927C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifUserComment", 0x9286)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifDTSubsec", 0x9290)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifDTOrigSS", 0x9291)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifDTDigSS", 0x9292)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFPXVer", 0xA000)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifColorSpace", 0xA001)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifPixXDim", 0xA002)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifPixYDim", 0xA003)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifRelatedWav", 0xA004)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifInterop", 0xA005)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFlashEnergy", 0xA20B)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSpatialFR", 0xA20C)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFocalXRes", 0xA20E)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFocalYRes", 0xA20F)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFocalResUnit", 0xA210)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSubjectLoc", 0xA214)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifExposureIndex", 0xA215)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSensingMethod", 0xA217)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifFileSource", 0xA300)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifSceneType", 0xA301)
		INSERT INTO crsProps (PropName, IDValue) VALUES("PropertyTagExifCfaPattern", 0xA302)
		INDEX ON IDValue TO IDValue
	ENDPROC

*************************
	PROCEDURE retrievepropname
*************************
		LPARAMETERS tnPropertyID
		LOCAL lcReturn
		lcReturn = "Unknown"
		IF SEEK(tnPropertyID, "crsProps", "IDValue")
			lcReturn = crsProps.PropName
		ENDIF
		RETURN lcReturn
	ENDPROC

*************************
	PROCEDURE getimageproperties
*************************
		LOCAL lnMax
		DIMENSION aryProps(1)
		aryProps(1) = NULL
		WITH THIS
			lnMax = .GGetPropertyIDList(@aryProps)
			CREATE CURSOR crsEXIF (Property C(50), DATA C(100))
			FOR lnCounter = 1 TO lnMax
				INSERT INTO crsEXIF (Property, DATA) VALUES (.retrievepropname(aryProps(lnCounter)), TRANSFORM(.GGetPropertyItem(aryProps(lnCounter))))
			ENDFOR
			GO TOP IN crsEXIF
		ENDWITH
	ENDPROC

*************************
	PROCEDURE fillpropertygrid
*************************
		WITH THIS
			.createpropertycursor()
			.getimageproperties()
			.grid1.RECORDSOURCE = "crsEXIF"
			.grid1.REFRESH()
			.grid1.AUTOFIT()
		ENDWITH
	ENDPROC

*************************
	PROCEDURE INIT
*************************
		LOCAL lcImageFile
		lcImageFile = GETPICT()
		IF EMPTY(lcImageFile)
			RETURN .F.
		ENDIF
		THIS.DeclareAPIs()
		THIS.gpImageHandle = THIS.GGetImageHandle(lcImageFile)
		THIS.fillpropertygrid()
	ENDPROC

*************************
	PROCEDURE DESTROY
*************************
		USE IN SELECT("crsProps")
		USE IN SELECT("crsEXIF")
	ENDPROC

*************************
	FUNCTION GGetPropertyCount()
*************************
		LOCAL lnCount
		m.lnCount = 0
		GdipGetPropertyCount(THIS.gpImageHandle, @m.lnCount)
		RETURN m.lnCount
	ENDFUNC

*************************
	FUNCTION GGetPropertyIDList(aryPropIDList)
*************************
		LOCAL lnCount, lcIdList, lnIndex
		m.lnCount = THIS.GGetPropertyCount()
		IF ISNULL(m.lnCount) OR m.lnCount < 1
			RETURN m.lnCount
		ENDIF

		m.lcIdList = REPLICATE(CHR(0), 4 * m.lnCount)
		GdipGetPropertyIdList(THIS.gpImageHandle, m.lnCount, @m.lcIdList)

		DIMENSION aryPropIDList(m.lnCount)
		FOR m.lnIndex = 1 TO m.lnCount
			aryPropIDList(m.lnIndex) = THIS.buf2num(SUBSTR(m.lcIdList, m.lnIndex * 4 - 3, 4))
		ENDFOR
		RETURN m.lnCount
	ENDFUNC

*************************
	FUNCTION GGetPropertyItem(tnPropID)
*************************
		LOCAL lnBufferSize, lnBufferPtr, lnStringPtr, ;
			lnPropertyTagType, lnValueLen, lnValuePtr, lvReturn

		m.lnBufferSize = 0

		GdipGetPropertyItemSize(THIS.gpImageHandle, m.tnPropID, @lnBufferSize)

		m.lnBufferPtr = GlobalAlloc(64, m.lnBufferSize)

		IF 0 == m.lnBufferPtr
			RETURN ""
		ENDIF

		GdipGetPropertyItem(THIS.gpImageHandle, m.tnPropID, ;
			m.lnBufferSize, m.lnBufferPtr)

		lnPropertyTagType = THIS.buf2num(THIS.GetMemString(m.lnBufferPtr + 8, 4))
		lnValueLen = THIS.buf2num(THIS.GetMemString(m.lnBufferPtr + 4, 4))
		lnValuePtr = THIS.buf2num(THIS.GetMemString(m.lnBufferPtr + 12, 4))

		DO CASE
			CASE INLIST(m.lnPropertyTagType,0,6,7,8)
				lvReturn = NULL
			CASE 1 == m.lnPropertyTagType
				lvReturn = ASC(THIS.GetMemString(m.lnValuePtr, 1))
			CASE 2 == m.lnPropertyTagType
				lvReturn = STREXTRACT(THIS.GetMemString(m.lnValuePtr, m.lnValueLen),'',CHR(0),1,2)
			CASE 3 == m.lnPropertyTagType
				lvReturn = ASC(THIS.GetMemString(m.lnValuePtr, 1)) + 256 * ASC(THIS.GetMemString(m.lnValuePtr + 1, 1))
			CASE 4 == m.lnPropertyTagType
				lvReturn = THIS.buf2num(THIS.GetMemString(m.lnValuePtr, 4))
			CASE 5 == m.lnPropertyTagType
				lvReturn = LTRIM(STR(THIS.buf2num(THIS.GetMemString(m.lnValuePtr, 4)))) + '/' ;
					+ LTRIM(STR(THIS.buf2num(THIS.GetMemString(m.lnValuePtr + 4, 4))))
			CASE 9 == m.lnPropertyTagType
				lvReturn = THIS.buf2num(THIS.GetMemString(m.lnValuePtr, 4))
				IF m.lvReturn > 2147483647
					lvReturn = m.lvReturn - 4294967296
				ENDIF
			CASE 10 == m.lnPropertyTagType
				LOCAL lnNum, lnDen
				lnNum = THIS.buf2num(THIS.GetMemString(m.lnValuePtr, 4))
				lnDen = THIS.buf2num(THIS.GetMemString(m.lnValuePtr + 4, 4))
				IF m.lnNum > 2147483647
					lnNum = m.lnNum - 4294967296
				ENDIF
				IF m.lnDen >2147483647
					lnDen = m.lnDen - 4294967296
				ENDIF
				lvReturn = LTRIM(STR(m.lnNum)) +'/'+LTRIM(STR(m.lnDen))
			OTHERWISE
				GlobalFree(m.lnBufferPtr)
				RETURN ""
		ENDCASE
		GlobalFree(m.lnBufferPtr)
		RETURN m.lvReturn
	ENDFUNC

*************************
	FUNCTION GGetImageHandle(tcFilename)
*************************
		LOCAL lnHandle
		m.lnHandle = 0
		GdipLoadImageFromFile(THIS.a2u(m.tcFilename + CHR(0)), @m.lnHandle)
		RETURN m.lnHandle
	ENDFUNC

************************
	FUNCTION buf2num(tcBuffer)
************************
		RETURN ASC(SUBSTR(tcBuffer, 1,1)) + ;
			ASC(SUBSTR(tcBuffer, 2,1)) * 2^8 + ;
			ASC(SUBSTR(tcBuffer, 3,1)) * 2^16 + ;
			ASC(SUBSTR(tcBuffer, 4,1)) * 2^24
	ENDFUNC

*************************
	FUNCTION GetMemString(tnString, tnMaxLength)
*************************
		LOCAL lcRet, lnNulfoundAt, lcReturn
		lcReturn = ""
		IF tnString != 0
			lcRet = SPACE(tnMaxLength)
			CopyMemory(@lcRet, tnString, LEN(lcRet))
			lnNulfoundAt = AT(CHR(0), lcRet)
			IF  lnNulfoundAt > 0
				lcRet = LEFT(lcRet, lnNulfoundAt - 1)
			ENDIF
			lcReturn = lcRet
		ENDIF
		RETURN lcReturn
	ENDFUNC

******************************
	FUNCTION a2u(cText)
******************************
*!* [URL unfurl="true"]http://www.news2news.com/vfp/?example=14&function=488[/URL]
******************************
		LOCAL lcBuffer, lnBufsize
		lcBuffer = ""
		lnBufsize = MultiByteToWideChar(0, 1,;
			cText, LEN(cText), @lcBuffer, 0)

		lcBuffer = REPLI(CHR(0), lnBufsize*2)  && in wide chars
		= MultiByteToWideChar(0, 1,;
			cText, LEN(cText), @lcBuffer, lnBufsize)
		RETURN lcBuffer
	ENDFUNC

*************************
	PROCEDURE DeclareAPIs()
*************************
		DECLARE INTEGER GdipLoadImageFromFile IN GDIPLUS.DLL ;
			STRING wFilename, INTEGER @ nImage
		DECLARE INTEGER GdipGetPropertyCount IN GDIPLUS.DLL ;
			INTEGER nImage, INTEGER @nCount
		DECLARE INTEGER GdipGetPropertyIdList IN GDIPLUS.DLL ;
			INTEGER nImage, INTEGER nCount, STRING @ LIST
		DECLARE INTEGER GlobalAlloc IN kernel32.DLL ;
			INTEGER nFlags, INTEGER nSize
		DECLARE INTEGER GlobalFree IN kernel32.DLL ;
			INTEGER nHandle
		DECLARE INTEGER lstrlenA IN kernel32.DLL AS __win32_lstrlenA_ptr INTEGER
		DECLARE INTEGER GdipGetPropertyItemSize IN GDIPLUS.DLL ;
			INTEGER nImage, INTEGER nPropID, INTEGER @ nBufSize
		DECLARE INTEGER GdipGetPropertyItem IN GDIPLUS.DLL ;
			INTEGER nImage, INTEGER nPropID, INTEGER nBufSize, INTEGER nBufferPtr
		DECLARE RtlMoveMemory IN kernel32 AS CopyMemory;
			STRING @ Destination, INTEGER SOURCE, INTEGER nLength
		DECLARE INTEGER WideCharToMultiByte IN kernel32;
			INTEGER CodePg, INTEGER dwFlags,;
			STRING lpWideCharStr, INTEGER cchWideChar,;
			STRING @lpMultiByteStr, INTEGER cbMultiByte,;
			STRING lpDefaultChar, INTEGER lpUsedDefaultChar
		DECLARE INTEGER MultiByteToWideChar IN kernel32;
			INTEGER CODEPAGE, LONG dwFlags, STRING lpMultiByteStr,;
			INTEGER cbMultiByte, STRING @lpWCharStr, INTEGER cchWChar
	ENDPROC

ENDDEFINE

boyd.gif

SweetPotato Software Website
My Blog
 
Craig,

Thanks for your continued interest.

I did have stringconvert() as a separate prg file.

I pasted your new code directly into a prg and ran it.

I got the

Program Error
Declare DLL caused an exception at the line

GdipLoadImageFromFile(THIS.a2u(m.tcFilename + CHR(0)), @m.lnHandle)


This is pretty much what I said before - there is no error number shown.


Regards

Eric
 
eric43,

All I can think of is that GDI+ is choking on the image you are trying to load. Try it with some other images, such as the ones that come with Visual FoxPro.

I'm not sure what you're running into here. The declare and what a2u return is correct, so the only thing I can guess is that GDI+ is unable to load the image and return an image handle for you.

I really don't have much else to offer in way of code or additional ways to fix this. If GDI+ is choking on your images then even upgrading to Visual FoxPro 9.0 wouldn't help you with this. The VFP code I have posted is now completely compatible with Visual FoxPro 6.0. Sorry, I'm out of ideas.

boyd.gif

SweetPotato Software Website
My Blog
 
Craig,

As I had picked a particular image each time, I tried another from my recent photography but no luck - still the same error. I aslo tried fox.bmp.

Is this code completely stand alone? Is there anything else that you think I am doing and may not be?

Is registering the dll needed?

Thank you for all your help in this quest.

Regards

Eric
 
Sorry Eric, I'm all out of ideas. Usually a Declare error like you are getting has to do with the way the DLL function was declared, but the code that I posted above can be copied and pasted into a prg and run just the way it is. Assuming that the code is exactly as it appears in my post, there shouldn't be any errors, even in Visual FoxPro 6.

Does anyone else (beside Eric) have a copy of VFP 6.0 still installed that they could run the above code with and report back if they are seeing the same problem as Eric? I'd appreciate it, thanks.

boyd.gif

SweetPotato Software Website
My Blog
 
Eric,

What version of the GDIPlus.dll do you have on that system? Also, is the GDIPlus.dll somewhere along the PATH of your system so that VFP can find it? Lastly, just to answer one of your questions... neither GDIPlus.dll or Kernel32.dll need to be registered. They are C DLLs as opposed to COM DLLs.

boyd.gif

SweetPotato Software Website
My Blog
 
Hi Craig

My GdiPluss.dll is Version 5.1.3102.2180 and I have a copy of it in the app Home folder. 4 Aug 2004 1,672 Kb

Regards

Eric
 
Tried Version 5.1.3102.1360 from Dll-files Same result

Eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top