简体   繁体   English

GetFileTitle的本地化版本?

[英]localized version of GetFileTitle?

I am desperately attempting to guess how the localized filename for photos can be retrieved given the path to that file. 我拼命地尝试猜测在给定文件路径的情况下如何检索照片的本地化文件名。 For instance, given the path 例如,给定路径

c:\\images\\jellyfish.png - Win 7 explorer and the built in image viewer program both display the word "Méduses" for a french win 7. Does this hold true for other versions of windows ? c:\\ images \\ jellyfish.png-Win 7资源管理器和内置的图像查看器程序都显示“Méduses”一词,表示法文Win7。这对于其他版本的Windows是否成立?

GetFileTitle only removes the extension and folder path giving me 'jellyfish' which is not what I am after, and after having read through MSDN and google it seems that the Windows Media Format's http://msdn.microsoft.com/en-us/library/dd798508(v=VS.85).aspx interface wouldn't help here. GetFileTitle仅删除扩展名和文件夹路径,给了我“水母”,这不是我想要的,并且在阅读了MSDN和google之后,似乎Windows Media Format的http://msdn.microsoft.com/zh-cn/ library / dd798508(v = VS.85).aspx接口在这里无济于事。 Either I have lost my googling skills or this is very poorly documented. 我丢失了谷歌搜索技能,或者记录得很差。 Help please ? 请帮助 ?

thank you 谢谢

I'm not sure about this case specifically (I've never encountered localized filenames in that form) but the only officially supported way I know of to get the localized filenames for system directories and the standard Windows applets, etc., is to use IShellFolder::GetDisplayNameOf. 我不确定这种情况(我从未遇到过这种形式的本地化文件名),但是我知道获取系统目录和标准Windows applet等的本地化文件名的唯一官方支持的方法是使用的IShellFolder :: GetDisplayNameOf。

So briefly, you need to get a PIDL for the file (SHParseDisplayName), bind to its parent folder (SHBindToParent), and then query for the display name using the SHGDN_INFOLDER flag. 简而言之,您需要获取文件(SHParseDisplayName)的PIDL,绑定到其父文件夹(SHBindToParent),然后使用SHGDN_INFOLDER标志查询显示名称。

Addendum: An even easier way (which I completely forgot about) is to use SHGetFileInfo to get the display name with the SHGFI_DISPLAYNAME flag. 附录:一种更简单的方法(我完全忘记了)是使用SHGetFileInfo来获取带有SHGFI_DISPLAYNAME标志的显示名称。 This means you don't need to muck around with PIDLs. 这意味着您不需要混搭PIDL。 SHGetFileInfo is essentially a wrapper around the various shell COM classes like IShellFolder - either way, the key is to use the shell to get the display name rather than the underlying API functions. SHGetFileInfo本质上是包装各种外壳COM类(如IShellFolder)的包装-两种方式的关键都是使用外壳获取显示名称,而不是基础API函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM