Windows 7 - How to select files in windows explorer window?

Asked By Agent Sylar - First Class Hero
05-Jan-10 12:26 PM
Hello and happy new year to everyone!

1. I want to select files in windows explorer windows from my external
application.
2. My external application is launched by my shell extension.
3. I want to select files and folders in windows explorer windows from which
my shell extension is invoked
4.My shell extension is launched when user right click in explorer windows
and then left click my shell extension menu entry
5. my program is file copy tool that allows user to paste files in windows
explorer window.
6. I want to select files copied by my application.

Thank you in advance!


--
mind has no limit
IDataObject
(1)
IShellView
(1)
TeraCopy
(1)
Hero
(1)
Functionalities
(1)
Cc144171
(1)
Windows
(1)
Appers
(1)
  Ivo Beltchev replied to Agent Sylar - First Class Hero
05-Jan-10 12:49 PM
Check this out:
http://blogs.msdn.com/oldnewthing/archive/2004/07/20/188696.aspx
Then once you have the IShellView you can call SelectItem. How do you
know the Explorer window is updated by that time though? Maybe your
items are not yet there to select.

Wouldn't it be easier if you do the copy from a drag/drop handler shell
extension? Explorer will take care of selecting the right items. The
extension can still communicate with your exe to do the actual copying,
if that is what you need. Ideally a separate exe is not needed. The
extension can do the copying in a separate thread.
  Agent Sylar - First Class Hero replied to Ivo Beltchev
06-Jan-10 07:58 AM
Hello Ivo Beltchev,
Thank you for your replay!

I will review example on link you have supplied. Does it cover the case when
file is pasten on desktop?

Why if I copy files inside my shell extension explorer will select right
items? What is difference with case when files are copied by external exe
file?
Is there a way to set shell to auto-select new file objects that appers?

How I can do copy in separate tread from inside shell extension?

--
mind has no limit
  Ivo Beltchev replied to Agent Sylar - First Class Hero
06-Jan-10 11:53 AM
Most likely it will not work for the desktop.


I am talking about a specific drag-and-drop handler. Look at the bottom
of http://msdn.microsoft.com/en-us/library/cc144171(VS.85).aspx.
I believe that if you create such a handler and perform your own
copying, Explorer will know to select the new files.

That's what other copy replacements like TeraCopy do.


Spawning a separate process is more expensive than a separate thread.
And the inter-process communication is harder to do. For example you
cannot pass a pointer to IDataObject to a process, but you can give it to
another thread.


Probably not.


Create a new thread, give it parameters, wait for it to finish. Just
like with a process.
  Agent Sylar - First Class Hero replied to Ivo Beltchev
08-Jan-10 02:01 PM
Hello Ivo Beltchev,

Thank you for your replay!

I tested copy tool you mentioned, but it does not select files as you
expected.
Also this is some very stupid tool that replaces default windows copy.
My application is same type, but much better :), and does not prevents users
to use defaults windows functionalities, but just extend them.
Link you have suplied looks interesting to me, so I will review it later.
Maybe I will try steps in exmple project you gave me in your first replay,
to see how thingd work

--
mind has no limit
help
is going wrong? Platform SDK Shell Discussions Vista (1) BindToTransferHandler (1) ITransferSource (1) BindToHandler (1) IDataObject (1) CShellItem (1) MoveItem (1) CopyItem (1) Flickr Drive, eh? You're using my sample do the copy process manually by extracting the data directly from the source item's IDataObject content. The new Windows FileOperation component is a really nice addition to Windows, but unfortunately not very clever at supporting legacy shell extensions for basic file-operations (ie. through the IDataObject) or extensions with limited functionality (such as the documented ITransferSource::MoveItem return codes). regards bjarke
dragging images, etc out of a low-integrity Internet Explorer window, the data in the IDataObject appears inaccessible. Calling GetData on any of the formats simply returns E_FAIL. And yet Explorer drop from IE? Thanks, Jon Potter Platform SDK Shell Discussions Windows 7 (1) DefaultDragDrop (1) IDataObject (1) MSPaint (1) XxKEY (1) X64 (1) Wow6432Node (1) SystemRoot (1) You need to register dragging images, etc out of a low-integrity Internet Explorer window, the data in the IDataObject appears inaccessible. Calling GetData on any o
Windows 64 bit Discussions Windows 7 (1) Excel (1) Word (1) GetDataObject (1) XP (1) IDataObject (1) Environment (1) GetFormats (1) Yes (rtfClipFormats is a Rich Text Box): private void GetFormats() { IDataObject iData = Clipboard.GetDataObject(); String[] arrayOfFormats = iData.GetFormats(false); rtfClipFormats.Clear(); foreach (string dataType in arrayOfFormats
Drop a text file into my IShellView window(Namespace extension), i Windows 7 Hi, all: I wrote an namespace extension of explorer is trying to do on your view. bjarke keywords: Drop, a, text, file, into, my, IShellView, window(Namespace, extension), , i description: Hi, all: I wrote an namespace extension of explorer. I
violently, even going into your Spelling Cop mode. You must be desperate, now that your hero Marty admitted in his own words that "WSR Toolkit" could NOT repair the broken code