Here you go sir!
code:
var WM_DROPFILES = 0x233;
function OnEvent_Initialize() {
var Wnd = MsgPlus.CreateWnd("Windows.xml","dragdrop");
Interop.Call("shell32", "DragAcceptFiles", Wnd.handle, true);
Wnd.RegisterMessageNotification(WM_DROPFILES, true);
}
function OndragdropEvent_MessageNotification(PlusWnd, Message, wParam, lParam){
switch(Message){
case WM_DROPFILES:
//Set some variables
var MAX_PATH = 260; //Maximum characters in a path
var lpszFile = Interop.Allocate((MAX_PATH+1)*2); //File name buffer
var arrFiles = new Array(); //Array to store the files in
//Get the files count
var nFilesCount = Interop.Call("shell32", "DragQueryFileW", wParam, 0xFFFFFFFF, 0, 0); //wParam is a handle to the dropped files
//Loop through the files
for(var i=0; i<nFilesCount; i++) {
var Result = Interop.Call("shell32", "DragQueryFileW", wParam, i, lpszFile, lpszFile.Size);
if(lpszFile.ReadString(0) != null) {
Debug.Trace("File "+i+": "+lpszFile.ReadString(0));
arrFiles.push(lpszFile.ReadString(0));
}
}
break;
}
}
Fully tested, don't worry.