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:
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
29 / Male / Flag
Joined: Nov 2006
Status: Away
O.P. [?] WM_DROPFILES and DragQueryFile
how do i use these both together?

i can't seem to get it working

code:
function OnEvent_Initialize(){
var Wnd = MsgPlus.CreateWnd("windows.xml","dragdrop");
Wnd.RegisterMessageNotification(WM_DROPFILES);
Interop.Call("shell32","DragAcceptFiles",Wnd.handle,true);
}

function OndragdropEvent_MessageNotification(PlusWnd, Message){
switch(Message){
case WM_DROPFILES:
Debug.Trace(Interop.Call("shell32","DragQueryFile",0,0xFFFFFFFF,null,0));
break;
}
}

This post was edited on 08-09-2007 at 03:23 AM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
08-09-2007 03:23 AM
Profile PM Web Find Quote Report
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
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
29 / Male / Flag
Joined: Nov 2006
Status: Away
O.P. RE: [?] WM_DROPFILES and DragQueryFile
thanks(Y) :)
[quote]
Ultimatess6
: What a noob mod
08-09-2007 05:44 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


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