2 Replies - 737 Views - Last Post: 31 December 2012 - 07:21 PM Rate Topic: -----

#1 gagarama  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 31-December 12

How do I open an audio file dragged onto my program?

Posted 31 December 2012 - 02:17 AM

I searched the web a lot and I haven't found any information about this.I want my music program, when i drag a file(.mp3,etc.) on it's icon, to open it and play it.What should I do?
Is This A Good Question/Topic? 0
  • +

Replies To: How do I open an audio file dragged onto my program?

#2 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: How do I open an audio file dragged onto my program?

Posted 31 December 2012 - 07:11 AM

If you drag a file to your app shortcut, Windows will attempt to open that file with your application.

File's path will come to your app as start parameter. I'll give you an example for console application:

Module Module1

    Sub Main(args() As String) 'notice the added args array here
        For Each arg In args
            If arg.EndsWith("wav") Then
                My.Computer.Audio.Play(arg)
            End If
        Next

        Console.ReadLine()
    End Sub
End Module



Now, if you compile this, and Alt + drag compiled .exe to the Desktop, it will create shortcut to this app's exe on your Desktop. Whenever you drag and drop a wav file to this shortcut, the app will run, and play the wav. That's the concept you can use for your needs.
Was This Post Helpful? 2
  • +
  • -

#3 gagarama  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 31-December 12

Re: How do I open an audio file dragged onto my program?

Posted 31 December 2012 - 07:21 PM

Thank you!!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1