开发者

How do I write to the clipboard to get a “create shortcut” option in windows explorer?

After putting a filedroplist on the clipboard – right clicking in windows explorer doesn’t give me the option to “create shortcut”. How do I get t开发者_如何学Chat?

Thanks.


You need other formats present, particularly the OLE stuff.

Experimenting with a diagnostic mode of my app (ClipMate), I see that when you have copied a file to the clipboard, and then right-click on the windows desktop, the following formats are read from the clipboard:

Ole Private Data
DataObject
Preferred DropEffect
HDROP
Shell IDList Array

And then when you actually perform "paste shortcut", an additional format is pulled:

Shell Object Offsets

I was able to perform a "paste shortcut" without the Preferred DropEffect, so I think that's optional. I tested on Windows XP, SP3. YMMV with other platforms.


This won't work as you want it to. When you drag a file on your computer and release the right-mouse the clipboard is not involved. You can test this by opening notepad, writing some text and copying it, then create a shortcut on your computer through right-clicking and finally pasting the text back into notepad. When you do this you'll see the text is still there which means no file was place "over" it.

So there's nothing that you can do to the clipboard to change the "create shortcut here" meaning. The closest thing that you can do is to create a shortcut as @IAbstract said and copy that shortcut to the clipboard. The you'll be able to right-click and paste the shortcut. See this article for more Drag & drop of a dynamically created shortcut

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜