Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to prevent drop files in the windows explorer

2 views
Skip to first unread message

Nuno

unread,
Jan 4, 2009, 1:41:22 PM1/4/09
to
Hello,

I'm trying to catch the file that is dropped in a certain system
folder, and avoid the copy or move operation of the same file.
Example: with two explorer windows opened, move or copy one file from
one window to the other window (each one in diferent system folders)
with the mouse, using the drag and drop operation, and my idea is when
the mouse button is released nothing is performed (copy or move) but
the desired file path is saved by my application.

I need to store the file (or files) location and name that the user
tried to copy or move to perform the same copy or move operation on
another time.

I already try to implement a shell extension that implements the
following interfaces:
IShellExtInit,
IContextMenu,
IPersistFile,
IDropTarget

And i thought that the IDropTarget may give what i want, but i can't
seem to put it to work. None of this functions are called:
DragEnter
DragOver
DragLeave
Drop

My idea is to cancel the drop operation but store the path to the
file, in order to be used in another time.

Can someone point me in the right direction to accomplish this, and if
the use of the IDropTarget interface is the right option to accomplish
what i desired, why the IDropTarget functions aren't called in my
shell extension?!

Thanks

PS: the IShellExtInit::Initialize(...) is called when the drop
operation is performed, and i can store the file path that is used,
but i can't cancel the copy or move operation performed by the
explorer.

Jon Potter

unread,
Jan 19, 2009, 4:29:59 PM1/19/09
to
You may be able to use a Copy hook to do this; see the MSDN documentation
for the ICopyHook interface for more details.

"Nuno" <nuno.e...@gmail.com> wrote in message
news:306ff5a3-17f4-4599...@35g2000pry.googlegroups.com...

Nuno

unread,
Jan 22, 2009, 6:57:47 PM1/22/09
to
On 19 Jan, 21:29, "Jon Potter" <jon_pot...@nospam.nospam> wrote:
> You may be able to use a Copy hook to do this; see the MSDN documentation
> for the ICopyHook interface for more details.
>
> "Nuno" <nuno.escul...@gmail.com> wrote in message

>
> news:306ff5a3-17f4-4599...@35g2000pry.googlegroups.com...
>
> > I'm trying to catch the file that is dropped in a certain system
> > folder, and avoid the copy or move operation of the same file.
> > Example: with two explorer windows opened, move or copy one file from
> > one window to the other window (each one in diferent system folders)
> > with the mouse, using the drag and drop operation, and my idea is when
> > the mouse button is released nothing is performed (copy or move) but
> > the desired file path is saved by my application.

Nop ICopyHook does not do the trick, because is only for folders or
printers:

removed from MSDN:
"...Shell folder or printer object can be moved, copied, renamed, or
deleted..."

But thanks anyway, i have not found any solution for my problem..i
will try to search for it...
Nuno

0 new messages