怎样使用CProgressCtrl显示文件拷贝的进度? CopyFile从硬盘拷贝文件到U盘,希望用CProgressCtrl显示拷贝的进度,请达人赐教,最好有代码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用以下两个函数:BOOL CopyFileEx(LPCTSTR lpExistingFileName, // name of existing fileLPCTSTR lpNewFileName, // name of new fileLPPROGRESS_ROUTINE lpProgressRoutine, // callback functionLPVOID lpData, // callback parameterLPBOOL pbCancel, // cancel statusDWORD dwCopyFlags // copy options);DWORD CALLBACK CopyProgressRoutine(LARGE_INTEGER TotalFileSize, // file sizeLARGE_INTEGER TotalBytesTransferred, // bytes transferredLARGE_INTEGER StreamSize, // bytes in streamLARGE_INTEGER StreamBytesTransferred, // bytes transferred for streamDWORD dwStreamNumber, // current streamDWORD dwCallbackReason, // callback reasonHANDLE hSourceFile, // handle to source fileHANDLE hDestinationFile, // handle to destination fileLPVOID lpData // from CopyFileEx);比如DWORD CALLBACK MyCopyProgressRoutine(LARGE_INTEGER TotalFileSize, // file sizeLARGE_INTEGER TotalBytesTransferred, // bytes transferredLARGE_INTEGER StreamSize, // bytes in streamLARGE_INTEGER StreamBytesTransferred, // bytes transferred for streamDWORD dwStreamNumber, // current streamDWORD dwCallbackReason, // callback reasonHANDLE hSourceFile, // handle to source fileHANDLE hDestinationFile, // handle to destination fileLPVOID lpData // from CopyFileEx){ CDialogTest* ptr = (CDialogTest*)lpData; // do something with pointer, e.g. ptr->m_Progressbar.Pos blahblah DWORD percent = TotalBytesTransferred*100/TotalFileSize; return TRUE;}BOOL CDialogTest::Copy(CString from, CString to){ BOOL cancel; return CopyFileEx( from, to, (LPPROGRESS_ROUTINE)MyCopyProgressRoutine, (this)this, &cancel, FALSE);} 怎么让状态栏随窗口自动定位,窗口变大时,状态栏也随之移到最下方 ACCESS mdb文件中表删除后,MDB文件大小并没有减小!why? 一个比较奇怪的问题 VS2010中 的类是如何管理的??? 赋值问题 调试问题? 急请赐教!!! 为什么会出现CPU的BUSY LOOP现象(不知道是不是 候老师 说的那种)?代码在里面,有时间可以进来看看。 关于ODBC,OLE DB和ADO 请问:读进一个特定格式的媒体文件,产生出VIDEO和AUDIO解码,这样的一个filter应该怎么写? 网络视频录象 Cdialog::domodal 问题
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
);比如
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
)
{
CDialogTest* ptr = (CDialogTest*)lpData;
// do something with pointer, e.g. ptr->m_Progressbar.Pos blahblah DWORD percent = TotalBytesTransferred*100/TotalFileSize;
return TRUE;
}BOOL CDialogTest::Copy(CString from, CString to)
{
BOOL cancel;
return CopyFileEx( from, to, (LPPROGRESS_ROUTINE)MyCopyProgressRoutine, (this)this, &cancel, FALSE);
}