本人最近在做有关手持设备的项目,手持设备和电脑上的数据要同步。我用的是ActiveSync,本来是手工同步,现在想写一个小插件,按一下按钮,直接完成同步,实现从手持设备上和电脑上对拷文件。本人是用c#写的,将电脑上的一个文件复制到移动设备上面,中间引用到OpenNETCF.Desktop.Communication.dll,代码编译没什么错误,就运行的时候出现could not create remote file 。上网查了好长时间,还是百思不得其解,本人估计是路径问题,可资源管理器上的路径就是这个路径呀。望高人指点,不胜感激。代码如下:
 private void button1_Click(object sender, EventArgs e)
        {
                 while (!myrapi.DevicePresent)
                {
                    MessageBox.Show("Please connect your device to your PC using ActiveSync and before clicking the OK button.", "No Device Present");
                    myrapi.Connect();
                }
//以下是wince移动设备上的某个文件,移动设备上明明有这个文件却提示我file not  exists,而且对拷文件的时候也提示我说could not create remote file
                bool flag = myrapi.DeviceFileExists(@"\Application\Samples.C.persist.reg");
            if (flag == true)
            {
           
                MessageBox.Show("file exists");
            }
            else
            {
                MessageBox.Show("file not exists");
                string localFileName = @"D:\aaa.txt";
                string fileInpdaName = @"\Windows\aaa.txt";
                myrapi.CopyFileToDevice(localFileName,fileInpdaName, true);
                myrapi.Disconnect();
               
            }        }