Introduction:This brief tutorial will detail how to get and install the headers and libraries needed to to MTP programming on Windows, and will lead you through a simple example which shows how to transfer a file to an MTP device. Getting this tutorial code to compile and run is not dependent on getting the Microsoft SDK's code to compile and run -- we just borrow the SDK's headers and one library.
Instructions:1) Download the Windows Media Format 9.5 SDK, which includes the Windows Media Device Manager 10 SDK. The SDK should be available at http://msdn.microsoft.com/windowsmedia/downloads/default.aspx (wmformat95sdk.exe).
2) Install the SDK.
3) Add the new lib and include directories (by default, c:\wmsdk\wmfsdk95\include, c:\wmsdk\wmfsdk95\wmdm\inc, c:\wmsdk\wmfsdk95\lib, and c:\wmsdk\wmfsdk95\wmdm\lib) into your IDE. For VS2005, this is done by selecting the panel at Tools..Options..Projects&Solutions..VC++ Directories. Other Microsoft development environments are similar.
4) Create a new 32-bit C++ command-line application template and test to make sure it compiles and links properly.
5) Replace the template code with this mtp_xfer_code.
6) Download the test file testfile.mp3 and place it in c:\music\ (or change the code to match where you put it).
7) Add the library "mssachlp.lib" to the debug and release build linker input library settings.
8) Build the revised project and run it.
Depending on what devices are available on your system, you should now be able to enumerate and see the properties of various media devices on your system, including connected Creative media devices.
Notes:The file wmdm.chm (default location c:\wmsdk\wmfsdk95\docs\wmdm.chm) is the help file -- very useful.
If you are running 64-bit Windows, the Windows Media Format 9.5 SDK installer isn't going to run. You can probably extract the contents of the SDK manually if necessary, but if you have a 32-bit installation available, use that and then transfer the files over manually to your 64-bit machine.
Last modified at 12/5/2007 2:14 PM by Phillip Williams