Question Deal with a file dragged onto your application on startup

12padams

Well-known member
Joined
Feb 19, 2010
Messages
48
Programming Experience
Beginner
Ok so I have a board game maker which allows you to easily make board games (.bgm files) and save them and also open them again with the program by selecting open in the file menu.

Screen shot below of the program running:
boardgamemakerscreensho.png


Now what I need is so that I am able to drag a .bgm file onto my program's icon and for it to automatically load it without having to select "open in the file menu.

openfilewithboardgamema.png


Where can I Paste the code which I copied from my file open menu so that .bgm files can open with my program?
 
When you drag & drop a file onto an executable (or a shortcut to the executable), it is in essence the same as running the application from a command prompt and passing the file path as a parameter. In other words, the shell runs the executable and sends the dropped file path as a parameter in the command-line arguments. If your application is configured to use the application framework, you have access to the command-line arguments as a property of the StartupEventArgs parameter of the Application.Startup event handler. Otherwise, you can access the command-line arguments with the System.Environment.CommandLine Property or the System.Environment.GetCommandLineArgs() method.
 
Back
Top