views:

377

answers:

2

I'm writing a C# winforms application that will transfer files from an iPhone or iTouch using the Manzana library.

My iPhone is called Mark's iPhone and I want this to display in the application. I can't find any simple way of finding this. Can anyone help. Please!

+1  A: 

First, go download the iTunes COM SDK. Create a new project and reference the library. I don't know anything about the library you're talking about, but I imagine it's built off of the SDK, so you may already have a reference.

The C# source code snippet below should get you the name of your iPhone. If it doesn't work, try ITSourceKindDevice instead of iPod.

iTunesApp app = new iTunesAppClass();
IITSourceCollection sources = app.Sources;
foreach(IITSource s in sources)
{
if(s.Kind == ITSourceKind.ITSourceKindIPod)
{
   Console.WriteLine("Type: " + s.Name);
}
Chris McCall
A: 

Pardon the vague answer, but I don't have the manzana sources in front of me.

To get the device's name, you need to call the AMDeviceCopyValue() function with the reference you have to the device and the key "DeviceName".

Pseudocode:

AMDeviceCopyValue(device, 0, "DeviceName");
iKenndac
Thanks. This is exactly what I was looking for. It doesn't work with my version of the Manzana source but I should be able to hack it from here.
Mark