Shoutbox

AcceptFiles listbox - 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: AcceptFiles listbox (/showthread.php?tid=72260)

AcceptFiles listbox by Dennis Mike on 03-02-2007 at 11:18 PM

how can i use this property for add direction from the dragged file to the listbox?


RE: AcceptFiles listbox by CookieRevised on 03-03-2007 at 02:07 AM

quote:
Originally posted by Dennis Mike
how can i use this property for add direction from the dragged file to the listbox?
You can't... (afaik)

That is, you can not do it unless you also use an external DLL to subclass the listview.

In Plus! scripting, you can subclass windows, but you can not subclass controls. And you need to subclass the listview control in order to use the drag/drop facility. There is no way to work around this I'm afraid...

Therefor, why the <AcceptFiles> was included in the listview is a small riddle to me :D. However, in the future I'm sure Patchou will add something to either subclass controls too or add some event which will trigger when files are dropped on a listview (which would be the best thing IMHO)...



Note: since you can subclass windows, you could drop files on a window and catch them though. For this you can use a small and very old API (is a leftover from Windows 95*). You need to tell Windows that your window can accept files. To do this you need to call the DragAcceptFiles API. When this is done, each time you drop files on your window, a WM_DROPFILES message will be posted from that window and you can get the dropped files using the DragQueryFile API.

But although this works for windows, here also lies the fact that you can not use this method for a control. This because the WM_DROPFILES message is posted from the window which accepted the files (your listview control), thus not send to its parent window... and the parent window is the only thing subclassable in Plus! scripting...

Other (more modern) methods like OLE2, also require methods not supported by Plus!. At least not that I know of..... But I actually hope I'm wrong here as I would like to use drag/dropping too.




* This was the method used in Windows 95 for setting windows to accept dropped files. Which since then better methods (OLE) were made. This also means that it is quite possible that this method will not work anymore in the future (eg: on Vista? dunno, don't have Vista atm to test it).
RE: AcceptFiles listbox by Dennis Mike on 03-03-2007 at 03:05 AM

the mesage WM_DROPFILES is produced by listbox not by the pluswnd
how can i register the messages of listbox?


RE: AcceptFiles listbox by CookieRevised on 03-03-2007 at 03:07 AM

As I said: you can not subclass controls with Plus! scripting, you can only subclass main Plus! windows, not the controls on them...

;)


RE: AcceptFiles listbox by Dennis Mike on 03-03-2007 at 03:12 AM

it would be good including in the following version
pluswnd.controlid.RegisterMessageNotification


RE: AcceptFiles listbox by CookieRevised on 03-03-2007 at 03:26 AM

yep, but the <AcceptFiles> attribute will still be useless then though, because that doesn't need to be set...

For dragging and dropping files on a listview it would be better and far more userfriendly if a new event will be added which accompanies <AcceptFiles>.



Note: you could still catch the WM_DROPFILES message though if you use the PeekMessage API. But this would require running in a loop and therefor this will also slow down or even halt everything in Messenger, therefor no good workaround...