Click here to Skip to main content
15,609,235 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I need to paste clipboard data automatically and so i try

SendKeys.Send("^V");

But it wont work for file drop list (it can paste text data only)

So how i can simulate Control + v button programmatically.

What I have tried:

SendKeys.Send("^V");


But it wont work for file drop list (it can paste text data only)
Posted
Updated 5-May-16 12:47pm
Comments
CHill60 5-May-16 13:11pm    
Where are you trying to "paste" this - give us some context
vishal2592 5-May-16 13:21pm    
desktop or any location location will be dynamic
Dave Kreskowiak 5-May-16 20:26pm    
How are you putting the focus on the destination window? How does your app know when to send the keystrokes?
Sergey Alexandrovich Kryukov 5-May-16 13:18pm    
Why?
—SA
Philippe Mori 6-May-16 21:00pm    
Users don't expect that... thus it is spam.

In C# the clipboard is a standard class called clipboard not surprisingly. It is pretty much accessible anywhere.

The pseudocode to get the list is
if (Clipboard.ContainsFileDropList())
{
   ReturnList = Clipboard.GetFileDropList()

   // Do whatever you want with list now .. paste them wherever.
}

Intercept whatever message you want WM_PASTE most likely and paste the list entries where you want too.
 
Share this answer
 
v3
try SendKeys.Send("^v"); with a lower case v

and then use the following code.

C#
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
      if (keyData == (Keys.Control | Keys.V))
      {
         var someData = Clipboard.GetFileDropList();
         //do something with the data
         return true;
      }
      else
      {
         return base.ProcessCmdKey(ref msg, keyData);
      }
}
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900