How to tell if a Windows phone is connected to a Windows 7 computer?

I am trying to create an application that detects if my Nokia Lumia 520 is connected to my laptop. I tried looking at:

    foreach (DriveInfo drive in DriveInfo.GetDrives())

      

Windows detects drives "C" and "D", but not the Windows phone.

Why doesn't Windows assign a drive letter to this device? When I go to My Computer, I see Computer \ Windows Phone.

I tried:

    if(Directory.Exists(@"Computer\Windows Phone"))
    {
        MessageBox.Show("Found");
    }

      

It doesn't signal to me that such a directory exists.

+3


source to share


1 answer


You must be using Windows Portable Devices APIs . They provide a sample app that lists portable devices, but it's in C ++. However, you can still use a C # application that uses these APIs as they are COM interfaces. Check out this blog-post , which does exactly that (there are many other helpful blog posts on this topic).



If you only want to check if a device is connected, you can do so .

0


source







All Articles