获取包含在Windows Media Center库目录 [英] Get directories included in Windows Media Center libraries

查看:143
本文介绍了获取包含在Windows Media Center库目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的Media Center(Windows自带7的版本)的加载项并要检索的用户已经包括在媒体库(图片,视频,录制的电视,电影物理目录列表,音乐)。

I'm writing an add-in for Media Center (the version that comes with Windows 7) and want to retrieve the list of physical directories which the user has included in the media libraries (pictures, videos, recorded tv, movies, music).

媒体中心对象模型( Microsoft.MediaCenter。* )似乎没有任何规定来获取此信息。

The Media Center object model (Microsoft.MediaCenter.*) does not seem to have any provision to get this information.

注册表具有的关键HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Media中心\MediaFolders ,然而这些总是空的。

The registry has a key at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Media Center\MediaFolders, however these are always empty.

有似乎是一个目录里%的完整列表USERPROFILE%\AppData\Local\Microsoft\Media Player\wmpfolders.wmdb ,但没有办法知道哪些媒体库中的每个目录涉及到,而且由于这些都是媒体的设置球员,他们的存在可能只是巧合。

There appears to be a complete list of the directories in %userprofile%\AppData\Local\Microsoft\Media Player\wmpfolders.wmdb, but there's no way to tell which media library each directory relates to and, since these are the settings for Media Player, their presence may just be coincidental.

有谁知道怎么的可靠的检索这些目录的列表,最好是从添加 - 中在组件(即使用C#)?

Does anyone know how to reliably retrieve a list of these directories, preferably from within the add-in assembly (i.e. using C#)?

推荐答案

我用反光带在ehshell请问这是怎么一个高峰。对于图片,视频,音乐和录制的电视它使用来自ehuihlp.dll导入方法。对于电影,它只是直接从拉列表HKCR\Software\Microsoft\Windows\CurrentVersion\Media Center\MediaFolders\Movie

I used Reflector to take a peak at how ehshell does this. For Pictures, Videos, Music, and Recorded TV it's using an imported method from ehuihlp.dll. For Movies it just pulls the list directly from HKCR\Software\Microsoft\Windows\CurrentVersion\Media Center\MediaFolders\Movie.

下面是如何使用导入的方法的例子:

Here's an example of how to use the imported method:

使用系统。 Runtime.InteropServices ;

...

[DllImport(@"c:\Windows\ehome\ehuihlp.dll", CharSet = CharSet.Unicode)]
static extern int EhGetLocationsForLibrary(ref Guid knownFolderGuid, [MarshalAs(UnmanagedType.SafeArray)] out string[] locations);



...

...

Guid RecordedTVLibrary = new Guid("1a6fdba2-f42d-4358-a798-b74d745926c5");
Guid MusicLibrary = new Guid("2112ab0a-c86a-4ffe-a368-0de96e47012e");
Guid PicturesLibrary = new Guid("a990ae9f-a03b-4e80-94bc-9912d7504104");
Guid VideosLibrary = new Guid("491e922f-5643-4af4-a7eb-4e7a138d8174")

...

string[] locations;
EhGetLocationsForLibrary(ref PicturesLibrary, out locations);

这篇关于获取包含在Windows Media Center库目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆