|
안녕하세요...
다름이 아니구요.... API함수의 사용법이 좀 궁금해서요...
CopyFile이 파일카피를 해주고 사용법이 간단한데요...윈도우에서 프로그레스바같은 상태를 좀 보여주려다 보니 CopyFileEx라는 함수가 있다는 걸 알게되었는데요..요 놈을 사용하려고 하는데 사용법을 알아야지요....
여기저기 검색하다가 데브피아에서 팁으로 하나를 보게 되었는데 빌더에 안 맞는 지 고대로 붙여서 해보니 제대로 동작을 안하네요...
보시고 답변 좀 부탁드릴께요...^^;
#define _WIN32_WINNT 0x0500
#define UNICODE
#include <windows.h>
#include <winbase.h>
DWORD CALLBACK CopyProgressRoutine(
LARGE_INTEGER TotalFileSize, // total file size, in bytes
LARGE_INTEGER TotalBytesTransferred,
// total number of bytes transferred
LARGE_INTEGER StreamSize, // total number of bytes for this stream
LARGE_INTEGER StreamBytesTransferred,
// total number of bytes transferred for
// this stream
DWORD dwStreamNumber, // the current stream
DWORD dwCallbackReason, // reason for callback
HANDLE hSourceFile, // handle to the source file
HANDLE hDestinationFile, // handle to the destination file
LPVOID lpData // passed by CopyFileEx
)
{
wprintf(L"[%%%I64u] TotalFileSize: %I64u, Transffered: %I64u\n",
TotalBytesTransferred.QuadPart*100 / TotalFileSize.QuadPart,
TotalFileSize, TotalBytesTransferred);
return PROGRESS_CONTINUE;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
BOOL b_cancel = false;
if(
CopyFileEx("c:\\max_file.dat",
"c:\\target_file.dat",
CopyProgressRoutine,
NULL,
&b_cancel,
COPY_FILE_FAIL_IF_EXISTS)
)
ShowMessage("true");
else
ShowMessage("false");
MSDN에서도 좀 봤는데 영 이해가 안 가네요...
답변 좀 부탁드리겠습니다...
|