Partager via


Folder Monitoring Registry Settings

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

Windows Media Player 9 Series or later can monitor file folders for new digital media files. When the Player detects a new file in a monitored folder, it automatically adds the file to the library. For Windows Media Player 9 through Windows Media Player 11, users can change the list of monitored folders by clicking Monitor Folders on the library tab of the Options dialog box. For Windows Media Player 12, a user can change the list of monitored folders by following the instructions in the topic Add items to the Windows Media Player Library. For Windows Media Player 9 through Windows Media Player 11, you can programmatically add a folder to be monitored by adding a value to the registry. For Windows Media Player 12, you cannot use the registry to programmatically add or remove folders to be monitored.

For Windows Media Player 9 through Windows Media Player 11, to add a folder for monitoring you must first create or modify two values in the following registry key:

HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences\

The new values must be named as follows.

Name Type Description
TrackFoldersDirectories REG_DWORD A DWORD value that represents the count of folders to monitor. This must match the count of TrackFoldersDirectoriesX values.
TrackFoldersDirectoriesX REG_SZ A string value that represents the path of the folder to monitor. Each folder to monitor requires a separate value. The suffix X is an integer that should always begin at 0 and then increment by 1. Windows Media Player also monitors subfolders of the specified folder.

 

For example, to add the first folder to monitor, add the following value:

[HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences]
"TrackFoldersDirectories0" = "c:\MyPath\MyFolder"

Then, create the count value:

[HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences]
"TrackFoldersDirectories" = dword:00000001

To add a second folder to monitor, add the following value:

[HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences]
"TrackFoldersDirectories1" = "c:\MyPath\MyFolder2"

Then, increment the count value:

[HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences]
"TrackFoldersDirectories" = dword:00000002

Registry Settings