void (CALLBACK* pfnNotifyTransferStatus) (FVSDK_CALLBACK_DATA pvNotifyTransferStatusData, UINT nStatus, FVSDK_TransferStatus* pStatus);
Called when new transfer status information is available. This callback function is only called when transfers are performed using the high-level transfer functions FVSDK_Upload() and FVSDK_Download().
pvNotifyTransferStatusData
The DWORD value set in the FVSDK_Session structure. The meaning of this value is application defined.
nStatus
The status information being updated. This value is defined in FVSDK_TransferStatus.h.
FVSDK_TRANSFER_NEW a new file transfer has started FVSDK_TRANSFER_END a file transfer is complete FVSDK_TRANSFER_SET_FILE_COUNT establishes the number of files to be transferred in a multiple file transfer FVSDK_TRANSFER_SET_FILE the file has changed in a multiple file transfer FVSDK_TRANSFER_SET_SIZE the file size has changed for a multiple file transfer FVSDK_TRANSFER_SET_POS the file position has changed for a multiple file transfer FVSDK_TRANSFER_INCREMENT_BYTE_OS the byte offset for a transfer has changed, usually indicating a resume operation FVSDK_TRANSFER_SET_BYTE_OS the byte offset for a transfer has been reset, usually indicating a resume operation
pStatus
A pointer to the FVSDK_TransferStatus containing the information about the transfer. Use the dwHandle member to identify the transfer being updated.
None
void CALLBACK CSampleCPPDlg::OnNotifyTransferStatus(FVSDK_CALLBACK_DATA pvNotifyTransferStatusData, UINT nStatus, FVSDK_TransferStatus* pTransferStatus)
{
CSampleDlg* pThis = (CSampleDlg *) pvNotifyTransferStatusData;
CWnd* pStatus = pThis->GetDlgItem(IDC_TRANSFER_STATUS);
CString sStatus, sOldStatus;
// nothing to do if we can't get the status control
if (! pStatus)
return ;
// determine if the file transfer is complete or this is a status message
if (nStatus == FVSDK_TRANSFER_END) {
// the transfer is done
sStatus = "Transfer: Complete";
} // if
else {
CString sStr, sTime;
double dBytesPerSec = pTransferStatus->dBytesPerSecond;
// make it a bit easier to read
if (dBytesPerSec <= 1024.00)
sStr = "bytes";
else if ((dBytesPerSec /= (double) 1024.00) < 1024.00)
sStr = "KB";
else {
sStr = "MB";
dBytesPerSec /= 1024.00;
} // else
// calculate the rate
sStatus.Format("Transfer: %02d:%02d:%02d (%s %s/sec)", pTransferStatus->dwRemainingHours,
pTransferStatus->dwRemainingMinutes, pTransferStatus->dwRemainingSeconds,
FormatDoubleStr(dBytesPerSec, 2), (LPCTSTR) sStr);
} // else
// get the current status
pStatus->GetWindowText(sOldStatus);
// update the display only if it's changed
if (sStatus != sOldStatus)
pStatus->SetWindowText(sStatus);
} // OnNotifyTransferStatus