同学找我说要做个能定时拷贝A盘(软盘)到硬盘的小软件,我懂一点C#,但是不知道怎么样读取A盘是否有盘的信息,如果用计划任务也能解决,但是因为同学对电脑基本不懂,所以要做个傻瓜式的,而且运行时是在后台运行。

解决方案 »

  1.   

    BOOL DeviceIoControl(
      (HANDLE) hDevice,        // handle to device of interest
      IOCTL_STORAGE_CHECK_VERIFY,  // dwIoControlCode, control code of
                               // operation to perform
      NULL,                    // lpInBuffer is not used; must be NULL
      0,                       // nInBufferSize is not used; must be zero
      NULL,                    // lpOutBuffer is not used; must be NULL
      0,                       // nOutBufferSize is not used;
                               // must be zero
      (LPDWORD) lpBytesReturned,   // pointer to variable to receive
                               // output byte count
      (LPOVERLAPPED) lpOverlapped  // pointer to OVERLAPPED structure
                               // for asynchronous operation
    );判断是否有盘
      

  2.   

    就用File,FileInfo类就完了,还有定时器,最小化就后台去了,只要启动最小化