IT
  1. using System;   
  2. using System.Collections.Generic;   
  3. using System.ComponentModel;   
  4. using System.Data;   
  5. using System.Drawing;   
  6. using System.Text;   
  7. using System.Windows.Forms;   
  8. using System.IO;   
  9. using System.Runtime.InteropServices;   
  10. using Common.RapiDesktop.Classes;   
  11. using OpenNETCF.Desktop.Communication;   
  12. namespace TestUSB   
  13. {   
  14.     public partial class Form1 : Form   
  15.     {   
  16.         HHFiles myHH;    
  17.         public Form1()   
  18.         {   
  19.             InitializeComponent();   
  20.                
  21.         }   
  22.     
  23.         private void button1_Click(object sender, EventArgs e)   
  24.         {   
  25.             RAPI rApi=new RAPI();   
  26.             if(rApi.DevicePresent)   
  27.             {   
  28.                 MessageBox.Show("已连接");   
  29.                 rApi.Disconnect();    
  30.                 myHH = new HHFiles();   
  31.                 String LocalFileName = @"c:\a.txt";   // 本地计算机文件名    
  32.                 String RemoteDeviceFileName = @"\DiskOnChip\a.txt";  // 远程设备文件名   
  33.                 myHH.CopyFileToDevice(LocalFileName, RemoteDeviceFileName, true);   
  34.                 MessageBox.Show("文件传输完毕");   
  35.                 rApi.Disconnect();    
  36.             }   
  37.             else  
  38.             {   
  39.                 MessageBox.Show("未连接");   
  40.                 rApi.Disconnect();    
  41.             }   
  42.         }   
  43.     }   
  44. }  
posted on 2010-06-30 09:11  liufei  阅读(742)  评论(0编辑  收藏  举报