ı發送我的文件到cliboard和ı想要複製指定的所有文件的路徑例如一個按鈕單擊桌面,文件如但我有問題我不會從列表框中獲取所有文件和我牛逼副本指定的路徑我怎麼能複製所有文件....c#將文件複製到指定路徑
public partial class Form1 : Form
{
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SetClipboardViewer(IntPtr hWnd);
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern bool ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
IntPtr SonrakiClipboardOgesi;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SonrakiClipboardOgesi = SetClipboardViewer(this.Handle);
}
protected override void WndProc(ref Message m)
{
int WM_DRAWCLIPBOARD = 0x0308;
int WM_CHANGECBCHAIN = 0x030D;
if (m.Msg == WM_DRAWCLIPBOARD)
{
ClipboardRead();
SendMessage(SonrakiClipboardOgesi, m.Msg, m.WParam, m.LParam);
}
else if (m.Msg == WM_CHANGECBCHAIN)
{
if (m.WParam == SonrakiClipboardOgesi)
{
SonrakiClipboardOgesi = m.LParam;
}
else
{
SendMessage(SonrakiClipboardOgesi, m.Msg, m.WParam, m.LParam);
}
}
base.WndProc(ref m);
}
private void ClipboardRead()
{
StringCollection col = new StringCollection();
col = Clipboard.GetFileDropList();
for (int i = 0; i < col.Count; i++)
{
listBox1.Items.Add(col[i]);
}
listBox1.SelectionMode = SelectionMode.MultiSimple;
for (int i = 0; i < listBox1.Items.Count; i++)
{
listBox1.SetSelected(i, true);
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
ChangeClipboardChain(this.Handle, SonrakiClipboardOgesi);
}
private void button1_Click(object sender, EventArgs e)
{
// ı make a with click copy within listbox files specified path
//What code I should write here
}
}
這是代碼的錯誤,我讓你知道我會告訴你從土耳其列表框中 – leonf 2012-04-24 10:11:25
的所有文件,你說土耳其語sevki? – leonf 2012-04-24 10:31:06
私人無效的button1_Click(對象發件人,EventArgs的){ // 我點擊列表框指定文件中拷貝路徑做出 //我應該在這裏寫 什麼碼} – leonf 2012-04-25 10:15:41