What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] WM_DROPFILES and DragQueryFile

[?] WM_DROPFILES and DragQueryFile
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: [?] WM_DROPFILES and DragQueryFile
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. ;)

This post was edited on 08-09-2007 at 07:12 AM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
08-09-2007 07:11 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[?] WM_DROPFILES and DragQueryFile - by roflmao456 on 08-09-2007 at 03:23 AM
RE: [?] WM_DROPFILES and DragQueryFile - by Matti on 08-09-2007 at 07:11 AM
RE: [?] WM_DROPFILES and DragQueryFile - by roflmao456 on 08-09-2007 at 05:44 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On