ScruffyDuck
ScruffyDuck

Reputation: 2666

Drag and Drop onto Desktop Icon

I think this should be simple. I have looked at similar questions here but it is not clear to my old brain as to how it should work. I have a Windows Forms Application. My users want to drag a file over the application icon on the desktop and execute the program with that file. So what I would like to do is:

Accept the dropped file on the icon; start the application and place the file path details into a textbox so that the user can process it.

The application is written in C#

Thanks

Upvotes: 6

Views: 5018

Answers (1)

Petar Minchev
Petar Minchev

Reputation: 47373

Try the following:

class Program
{
   static void Main(string[] args)
   {
       // args[0] is the file
   }
}

Upvotes: 11

Related Questions