共用方式為


FormatCode Registry Entry

[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.]

When Windows Media Player encounters a custom file name extension, it looks for a registry subkey that matches the extension. The subkey is described in File Name Extension Registry Settings. One of the registry entries that can appear under the extension's subkey is the FormatCode entry.

The FormatCode registry entry specifies the Media Transport Protocol (MTP) format code for files that have the custom extension. The FormatCode registry entry has the following form.

Name Type Value
FormatCode REG_DWORD A 16-bit positive integer that identifies the format of the file.

 

When the user attempts to copy a digital media file that has a custom file name extension to a portable device, Windows Media Player looks in the registry to find a format code associated with the custom file name extension. If Windows Media Player finds a format code, it uses MTP to determine whether the device supports the custom file format. If the device supports the format, the media file is copied to the device without being transcoded.

A device that supports MTP can supply Windows Media Player with a DeviceInfo dataset, which contains, among other things, a list of format codes supported by the device.

If you are in the process of developing a custom file format, you can request a format code from Microsoft. For information about how to request a format code, see the Microsoft Media Transport Protocol Porting Kit, which is available at the Microsoft Windows Media Developer Center.

File Name Extension Registry Settings