C++ 回调函数问题
请问怎么才能知道在调用 一个回调函数开始 到 这个回调函数结束用了多长时间 C++ 回调函数
[解决办法]
//-------------------------------------------------
// 功能:从设备下载文件状态回调函数
// 参数:pDeviceID:设备IDhDeviceKey:设备key
// hChannelKey:通道key
// uiReceived:已经发送字节数
// uiTotal:总长度
// pBuffer:缓冲区(从设备下载时候有效)
// uiBufferLength:缓冲区长度(从设备下载时候有效)
// uiUserData1,uiUserData2:用户数据
// 返回:true:下一包false:继续之前的数据包
//-------------------------------------------------
bool CALLBACK CTestSDKDlg:: DownloadFromDeviceStatusCallback(
const char* pDeviceID,int hDeviceKey,
int hChannelKey,
unsigned int uiReceived,
unsigned int uiTotal,
char* pBuffer,
unsigned int uiBufferLength,
unsigned int uiUserData1,
unsigned int uiUserData2)
{
CTestSDKDlg* pDLG = (CTestSDKDlg*)uiUserData1;
TRACE("\n (%s)(%x)Downloading(%d,%d).",pDeviceID,hChannelKey,uiTotal,uiReceived);
if(uiReceived == uiTotal)
{
mapDeviceHandles_Iter it = pDLG->m_mapDevices.find((int)uiUserData2);
if(it == pDLG->m_mapDevices.end())
return true;
SYSTEMTIME cur;
GetLocalTime(&cur);
TRACE("\n YEAR(%d)MONTH(%d)DAY(%d)HOUR(%d)MINUTE(%d)Second(%d).",cur.wYear,cur.wMonth,cur.wDay,cur.wHour,cur.wMinute,cur.wSecond);
s_NV_Devices& stDevice = it->second;
NVAPI_CloseDownloadFromDevice(stDevice.hDeviceKey,stDevice.hDownload );
char szText[MAX_PATH]={0};
strcpy_s(szText,MAX_PATH-1,"\n 文件下载完成");
pDLG->GetDlgItem(IDC_EDIT_ERRORCODE)->SetWindowText(szText);
stDevice.hDownload = NULL;
}
return pDLG->m_bContinue;
}