Dmitrii Kurylev
Dmitrii Kurylev

Reputation: 437

effect drag and drop file icon on my program effect

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.

enter image description here

Upvotes: 0

Views: 120

Answers (1)

align
align

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

Related Questions