Professional applications allow dropping one file after the other, or even multiple files together onto the program window to quickly switch the file you're working on.
If you're like me, you always have an explorer window with the files you currently work on open anyways. Its much more annoying to navigate through a dialog, copy pasting the path of that folder than being able to simply drag n' drop the next file.
One of the Game Maker's strengths is its easy to learn drag and drop programmability. Why should dragging and dropping with Game Maker stop there?
Well it doesn't anymore! This GM DragAcceptFiles Extension (name inspired by the WinApi command of the same name) instantly enables the Game Maker window to receive files dropped onto it - without writing a single line of code for this.
It then provides just three functions necessary for reading back the paths of the files and folders dropped:
- daf_get_file_count() Returns the amount of files that have been dropped on the window since the last call to daf_clear_files() or since the game has been started.
- daf_get_file(index) Returns the full path of the indexth file dragged and dropped on the window. index should be between 0 and daf_get_file_count()-1, otherwise an empty string is returned.
- daf_clear_files() This last command is used to clear the list of dropped files.
Download
The following package includes the extension (coming with a help included), a .gm81 example (+ compiled version), the .ged source file and all the other source files used in the creation of this extension:
- The help .html, .css, .hpp (Microsoft HTML Help Workshop Project file) and compiled .chm files.
- The tiny gml function internally used for initialization.
- The whole MS Visual Studio 2010 Project of the dll, ready to be changed and recompiled.
Download the GM DragAcceptFiles Extension, including source files and example
hotlink-hosted on Dropbox,stats, d
This extension doesn't only serve as an extension by itself - by coming with all source files, this is also meant to be an example for people new to the wonderful world of Game Maker extension creation. Honestly, I've never seen an easier way to extend a game engine/programming environment. Setting up new libraries in C++ on MSVC is really annoying so people won't do it for small libs or to just recompile something they would have liked to play with a little. Instead of using these hard to set up libraries, many people reinvent the wheel over and over.
I'll be happy to answer any questions regarding the source code and to help with any problems that might occur during recompilation (à la "Where can I find the ... program?").
More Usage Examples
Screenshot of the included demo:

To show the name of the last file dropped in a message box put the following code in the step event of any object:
if (daf_get_file_count() > 0)
{
show_message(daf_get_file(daf_get_file_count() - 1));
daf_clear_files();
}I hope you like it!
- Paul
Alternatives
Existing dlls (do you know of any more? any extensions? any open source ones?) doing (pretty much) the same:
Tags
game maker drag and drop files Onto Gm Window, drag-and-drop, d&d, winapi, wrapper, game maker drop files, game maker drop, game maker drag
Edited by Master Xilo, 16 July 2012 - 02:17 PM.











