BOOL CopyFileEx(
  LPCTSTR lpExistingFileName,           // name of existing file
  LPCTSTR lpNewFileName,                // name of new file
  LPPROGRESS_ROUTINE lpProgressRoutine, // callback function
  LPVOID lpData,                        // callback parameter
  LPBOOL pbCancel,                      // cancel status
  DWORD dwCopyFlags                     // copy options
);
DWORD CALLBACK CopyProgressRoutine(
  LARGE_INTEGER TotalFileSize,          // file size
  LARGE_INTEGER TotalBytesTransferred,  // bytes transferred
  LARGE_INTEGER StreamSize,             // bytes in stream
  LARGE_INTEGER StreamBytesTransferred, // bytes transferred for stream
  DWORD dwStreamNumber,                 // current stream
  DWORD dwCallbackReason,               // callback reason
  HANDLE hSourceFile,                   // handle to source file
  HANDLE hDestinationFile,              // handle to destination file
  LPVOID lpData                         // from CopyFileEx
);
我怎么连CopyFileEx都不能用,我是WIN2000的,
还有我要实现复制文件显示进度,可以对其加以控制,怎么写?

解决方案 »

  1.   

    http://www.vckbase.com/document/viewdoc/?id=1212
      

  2.   

    控制?中止?暂停?呵呵,一个一个文件Copy的时候,自己写倒是有可能。
      

  3.   

    error C2065: 'CopyFileEx' : undeclared identifier
    error C2065: 'COPY_FILE_ALLOW_DECRYPTED_DESTINATION' : undeclared identifier要加什么头文件吗?
      

  4.   

    To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later.
      

  5.   

    For example, to use the features specifically ed for Windows 2000 in the header files, you need to explicitly define _WIN32_WINNT as 0x0500 or greater. You can define the symbols using the #define statement in each source file, or by specifying the /D_WIN32_WINNT=0x0500 compiler option supported by Visual C++.
      

  6.   

    不是吧,请说清楚点,是我的platform sdk
    不够新吗?还是因为什么?不用包含头文件就行吗?
      

  7.   

    DWORD CALLBACK MyCopyProgressRoutine(
    LARGE_INTEGER TotalFileSize, // file size
    LARGE_INTEGER TotalBytesTransferred, // bytes transferred
    LARGE_INTEGER StreamSize, // bytes in stream
    LARGE_INTEGER StreamBytesTransferred, // bytes transferred for stream
    DWORD dwStreamNumber, // current stream
    DWORD dwCallbackReason, // callback reason
    HANDLE hSourceFile, // handle to source file
    HANDLE hDestinationFile, // handle to destination file
    LPVOID lpData // from CopyFileEx
    )
    {
    DWORD percent = TotalBytesTransferred*(100/TotalFileSize);//出错???????
    return PROGRESS_CONTINUE;
    }
    void CA2EDlg::OnButtonStop() 
    {
    CString str1;
    CString str2;
    str1="c:\\1\\1-1.wav";
    str2="d:\\1-1.wav";
    BOOL cancel=FALSE;
    BOOL kkk=CopyFileEx(str1,str2,&MyCopyProgressRoutine,this,&cancel,COPY_FILE_RESTARTABLE);
    if (kkk)
    {
    MessageBox("true");
    }
    else
    MessageBox("false");
    }
    我想实现进度条,可是在回调函数里,类型转换出现问题,请指教?怎样实现进度条?
      

  8.   

    DWORD CALLBACK MyCopyProgressRoutine(
    LARGE_INTEGER TotalFileSize, // file size
    LARGE_INTEGER TotalBytesTransferred, // bytes transferred
    LARGE_INTEGER StreamSize, // bytes in stream
    LARGE_INTEGER StreamBytesTransferred, // bytes transferred for stream
    DWORD dwStreamNumber, // current stream
    DWORD dwCallbackReason, // callback reason
    HANDLE hSourceFile, // handle to source file
    HANDLE hDestinationFile, // handle to destination file
    LPVOID lpData // from CopyFileEx
    )
    {
    DWORD percent = TotalBytesTransferred*(100/TotalFileSize);//出错???????
    return PROGRESS_CONTINUE;
    }
    void CA2EDlg::OnButtonStop() 
    {
    CString str1;
    CString str2;
    str1="c:\\1\\1-1.wav";
    str2="d:\\1-1.wav";
    BOOL cancel=FALSE;
    BOOL kkk=CopyFileEx(str1,str2,&MyCopyProgressRoutine,this,&cancel,COPY_FILE_RESTARTABLE);
    if (kkk)
    {
    MessageBox("true");
    }
    else
    MessageBox("false");
    }
    我想实现进度条,可是在回调函数里,类型转换出现问题,请指教?怎样实现进度条?