[?] WM_DROPFILES and DragQueryFile - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [?] WM_DROPFILES and DragQueryFile (/showthread.php?tid=76644)
[?] WM_DROPFILES and DragQueryFile by roflmao456 on 08-09-2007 at 03:23 AM
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;
}
}
RE: [?] WM_DROPFILES and DragQueryFile by Matti on 08-09-2007 at 07:11 AM
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.
RE: [?] WM_DROPFILES and DragQueryFile by roflmao456 on 08-09-2007 at 05:44 PM
thanks
|