Reputation: 437
How can I achieve the effect of dragging an arbitrary file icon on the icon of my program? That is, I want to make it so that if I drag a file to my program, the program starts and opens this file. In the figure, MyProgram is a program in C # that I write. File is the file I want to open.
Upvotes: 0
Views: 120
Reputation: 361
As Jens commented you may check Environment.GetCommandLineArgs
or you can just use main method arguments:
public static void Main(string[] args)
{
if (args.Length > 0)
Console.WriteLine(args[0]); // Here's the file path
}
Upvotes: 1