Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Drop files simulation


  • Please log in to reply
5 replies to this topic
Smurth
  • Members
  • 120 posts
  • Last active: Feb 23 2014 09:58 PM
  • Joined: 13 Dec 2006
Hi,

I'm planing to make a desktop replacement; I mean a window covering the whole desktop with icons on it. Drawing icons and making them draggable should be easy.
Since each icon will be associate with a real file, it would be cool to be able to drag it and drop it onto an application. I guess I should use messages like WM_DROPFILES: <!-- m -->http://msdn.microsof...y/bb774303.aspx<!-- m -->

But I should make one DROPFILES structure like this: <!-- m -->http://msdn.microsof...y/bb773269.aspx<!-- m -->

... and I really don't know how to do this :oops:

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

I guess I should use messages like WM_DROPFILES:


That would be overdoing the thing, since AHK has a built-in handler label GuiDropFiles: ( like GuiClose: , GuiContextMenu: )

Both the methods in same topic:
How to drop a picture file into a picture control posted by daniel06600

Smurth
  • Members
  • 120 posts
  • Last active: Feb 23 2014 09:58 PM
  • Joined: 13 Dec 2006
No, SKAN, you misunderstood what I meant (or I didn't explain it well)
I don't want to drop files onto an AHK window...
I want to drag an AHK window, which is intended to be a representation of some file, and drop it onto another window like explorer, foobar, etc.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

No, SKAN, you misunderstood what I meant (or I didn't explain it well)


By the time I understood, I had already posted :)
AFAIK, this has not been till date. My best guess is - this will require COM and so you may request Sean in a PM.

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

AFAIK, this has not been till date.

It's not quite true. ;) I did it almost two years ago, although I didn't add an example doing via IDropSource:
<!-- m -->http://www.autohotke...topic21966.html<!-- m -->

For this, need to implement two interfaces: IDropSource & IDataObject
In the script, I implemented IDropSource and utilized Clipboard as the IDataObject supplier.
Anyway, I recommend using SHDoDragDrop instead, then, you don't even have to implement IDropSource yourself.
<!-- m -->http://msdn.microsof...y/bb762151.aspx<!-- m -->

Although the documentation mention only Vista for shell's providing IDropSource, it worked on my XP too. So, the routine would be like this:
sPath := A_ScriptFullPath ; path of the target file
SplitPath, sPath, sName, sDir
COM_Init()
...

psh := COM_CreateObject("Shell.Application")
COM_Invoke(psh, "NameSpace[" sDir "].ParseName[" sName "].InvokeVerb", "Copy")
COM_Release(psh)
If	DllCall("ole32\OleGetClipboard", "UintP", pdata)=0
	DllCall("shell32\SHDoDragDrop", "Uint", 0, "Uint", pdata, "Uint", 0, "Uint", 1|4, "UintP", nEffect), COM_Release(pdata)

...
COM_Term()


SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

AFAIK, this has not been till date.

It's not quite true. ;) I did it almost two years ago


:oops: