Real Software Forums
http://forums.realsoftware.com/

how do you access comments of a file from windows explorer?
http://forums.realsoftware.com/viewtopic.php?f=6&t=47543
Page 3 of 3

Author:  mandjb [ Sat May 04, 2013 11:09 am ]
Post subject:  Re: how do you access comments of a file from windows explor

Thanks again. I have changed that line to:

n = SHGetFileInfo sPath, 0, FInfo, Len("FInfo"), SHGFI_TYPENAME

and now I get this error:

Code, Module2.GetFileDescription, line 14, This method requires more parameters than were passed, n = SHGetFileInfo sPath, 0, FInfo, Len("FInfo"), SHGFI_TYPENAME

It seems to me that the number of parameters match.

Author:  timhare [ Sat May 04, 2013 2:48 pm ]
Post subject:  Re: how do you access comments of a file from windows explor

In your previous code, you only had one parameter for GetFileDescription - the FolderItem. Those parameters look like they should be passed to SHGetFileInfo, not your method named GetFileDescription.

Also, there is an error in that Len("Finfo") should not have Finfo in quotes.

Author:  mandjb [ Sun May 05, 2013 2:52 pm ]
Post subject:  Re: how do you access comments of a file from windows explor

I commented out SHGetFileinfo and the return and set a break point to see if the bgfile gets passed to GetFileDescription and it does.
It shows up as the absolutepath in the variable sPath that is used in SHGetFileinfo.

I think that is just the way it should work so I still am not sure what other parameter it needs.

Author:  mandjb [ Thu May 09, 2013 10:39 pm ]
Post subject:  Re: how do you access comments of a file from windows explor

Can anyone please clue me in on what parameters I am missing for SHGetFileinfo?

Author:  timhare [ Thu May 09, 2013 11:19 pm ]
Post subject:  Re: how do you access comments of a file from windows explor

When you call a function that returns a value, you must enclose the parameters in parens:

n = SHGetFileInfo(sPath, 0, FInfo, FInfo.Size, SHGFI_TYPENAME)

Author:  mandjb [ Mon May 13, 2013 11:51 am ]
Post subject:  Re: how do you access comments of a file from windows explor

Well I fixed the parenthesis problem and so the next error is as follows complaining about Len(FIno)

Code, Module2.GetFileDescription, line 13, Parameters are not compatible with this function, n = SHGetFileInfo(sPath, 0, FInfo,Len(FInfo), SHGFI_TYPENAME)

So I know the length and I replaced Len(FInfo) with 352 like so n = SHGetFileInfo(sPath, 0, FInfo,352, SHGFI_TYPENAME) and it seems to work that way

and now the next problem that shows up is:

Code, Module2.GetFileDescription, line 16, Syntax error, Return Left(FInfo.szTypeName, InStr(FInfo.szTypeName & chr(0), chr(0)) - 1)

Author:  timhare [ Mon May 13, 2013 3:33 pm ]
Post subject:  Re: how do you access comments of a file from windows explor

To get the size of a structure, use FInfo.Size, not Len(FInfo). Len() is for string variables.
The string concatenation operator is +, not &.

Author:  mandjb [ Tue May 14, 2013 12:09 pm ]
Post subject:  Re: how do you access comments of a file from windows explor

Thanks again for all your help. Now the program does run to completion.
Trouble is it does not return the comments for the current background image.
I want to show the comments that are in the properties/details tab from windows explorer in textarea1 along with the file name, but the code I have does not return anything.
The file name part works fine but the comments do not.

Author:  mandjb [ Fri May 17, 2013 12:08 pm ]
Post subject:  Re: how do you access comments of a file from windows explor

I want to show the comments that are in the properties/details tab from windows explorer in textarea1.
Does anyone know if SHGetFileInfo will give me the above comments or if not is there any other way to accomplish this?

Author:  timhare [ Fri May 17, 2013 12:29 pm ]
Post subject:  Re: how do you access comments of a file from windows explor

Comments for an image file are stored in the file itself. You need to read and parse the exif data.

Author:  mandjb [ Mon May 20, 2013 11:45 am ]
Post subject:  Re: how do you access comments of a file from windows explor

Hi timhare,

I thought that was what SHGetFileInfo was for but I did not get anything returned from it.
Do you know if SHGetFileInfo is accessing the EXIF data? Another term that I've seen is
Metadata. Is this the same as EXIF data?
I have been searching for info on where in the file the comments are stored so that I can
access them. So far I have seen info on where a lot of other info on the file is stored but
have not seen anything about the comments. I will keep searching.
Thanks again for all your help.

Author:  timhare [ Mon May 20, 2013 2:33 pm ]
Post subject:  Re: how do you access comments of a file from windows explor

mandjb wrote:
I thought that was what SHGetFileInfo was for but I did not get anything returned from it.
Do you know if SHGetFileInfo is accessing the EXIF data?

It is not.

Quote:
Another term that I've seen is Metadata. Is this the same as EXIF data?

Yes. At least, it can refer to the exif data. It can be used in a broader sense, also.

Page 3 of 3 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/