复制粘贴的问题

vokxchh 2013-04-14 08:06:16
Regex reg = new Regex("^a1.mp3");          




Shell S = new Shell();

int CSIDL_INTERNET_CACHE = 0x20;




Folder F = S.NameSpace(CSIDL_INTERNET_CACHE);



foreach (FolderItem FI in F.Items())

{



Match ma = reg.Match(FI.Path);




if (ma.Success == true)

{











foreach (FolderItemVerb FIV in FI.Verbs())

{





if (FIV.Name == "复制(&C)"||FIV.Name =="©")

{

FIV.DoIt();



break;

}



}




}



}













Regex reg2 = new Regex("sometimes");

int CSIDL_DESKTOP = 0x00;



Folder G = S.NameSpace(CSIDL_DESKTOP);



foreach (FolderItem GI in G.Items())

{



Match ma = reg2.Match(GI.Path);




if (ma.Success == true)

{

foreach (FolderItemVerb GIV in GI.Verbs())

{



if (GIV.Name == "粘贴(&P)"||GIV.Name =="&Paste")

{

GIV.DoIt();



break;

}



}



}





}

Marshal.FinalReleaseComObject(S);

}




}


就是将ie临时文件中的a1.mp3复制到桌面的sometimes文件夹。经常失效。好像是没有复制到,然后把原来剪切板中的内容复制到文件夹中去了。。。我用搜狗浏览器截图的时候也经常碰到这种问题,就是提示复制到了,然后ctrl+v还是上次的那张图片。。。
...全文
161 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
vokxchh 2013-04-22
  • 打赏
  • 举报
回复
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
//using System.Text.RegularExpressions;
//using System.Collections;   


namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string path = (Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\sometimes");
            if (!Directory.Exists(path))
            {

                Directory.CreateDirectory(path);
            }
            System.Threading.Thread.Sleep(2000);
           
           // ArrayList sth= new ArrayList(); 
             //string path2 = (Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));
           string path4;
           
            string path3 = (Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)) + "\\Content.IE5";
            DirectoryInfo TheFolder2 = new DirectoryInfo(path3);
            foreach (DirectoryInfo NextFolder2 in TheFolder2.GetDirectories())

            // sth.Add(NextFolder2.Name);

            //   foreach (Object o in sth)
            {
                // path4 = path3 + "/" + o.ToString();
                path4 = path3 + "\\" + NextFolder2.Name;
                DirectoryInfo TheFolder4 = new DirectoryInfo(path4);

                foreach (FileInfo NextFile in TheFolder4.GetFiles())

                    if (NextFile.Name == "a1.mp3") File.Copy(NextFile.FullName, path + "\\To love's End.mp3", true); break;


            }
        }
    }
}
vokxchh 2013-04-19
  • 打赏
  • 举报
回复
引用 3 楼 caozhy 的回复:
知道胡乱找人家的代码不稳定就沉下心来自己写!
。。。http://baike.baidu.com/view/9416848.htm http://bbs.csdn.net/topics/330036717 这个确实是改的,不过确实是很标准的操作啊,看了好久才看懂,就是有时候复制不到,不知道怎么回事。特殊文件夹不好操作啊,有路径就好了。不行的话,只能换方法了。这个不怎么好找。。
threenewbee 2013-04-19
  • 打赏
  • 举报
回复
知道胡乱找人家的代码不稳定就沉下心来自己写!
vokxchh 2013-04-19
  • 打赏
  • 举报
回复
各位碰到过同样的问题吗?
vokxchh 2013-04-16
  • 打赏
  • 举报
回复
有没有其他把ie临时文件复制出来的方法吗,这个似乎不怎么稳定

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧