海康威视 NET_DVR_FindNextFile 的错误

    public struct NET_DVR_FIND_DATA
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]

        /// <summary>
        /// 文件名
        ///     char sFileName[100];
        /// </summary>
        public string sFileName;
        /// <summary>
        /// 文件的开始时间
        /// </summary>
        public NET_DVR_TIME struStartTime;
        /// <summary>
        /// 文件的结束时间
        /// </summary>
        public NET_DVR_TIME struStopTime;
        /// <summary>
        /// 文件的大小
        /// </summary>
        public uint dwFileSize;
    }
      int FindFile = HCNetSDK.NET_DVR_FindNextFile(lRealHandle, ref Net_DVR_FindData);
             if (Findhandle != -1)
             {
                 //当找到录像文件时接口将返回1000,当没有查找到文件或查找结束将返回1003或者1004,返回1002表示当前正在查找
                 while (FindFile != 1003)
                 {
                     switch (FindFile)
                     {
                         case 1000:
                             HCNetSDK.NET_DVR_FIND_DATA FindData = new HCNetSDK.NET_DVR_FIND_DATA();
                             FindData.sFileName = Net_DVR_FindData.sFileName;
                             FindData.dwFileSize = Net_DVR_FindData.dwFileSize;
                             FindData.struStartTime = Net_DVR_FindData.struStartTime;
                             FindData.struStopTime = Net_DVR_FindData.struStopTime;
                             dgvFile.Rows.Add(new object[] { FindData.sFileName, FindData.dwFileSize, string.Format("{0}.{1}.{2} {3}:{4}:{5}", FindData.struStartTime.dwYear, FindData.struStartTime.dwMonth, FindData.struStartTime.dwDay, FindData.struStartTime.dwHour, FindData.struStartTime.dwMinute, FindData.struStartTime.dwSecond) });
                             FindFile = HCNetSDK.NET_DVR_FindNextFile(Findhandle, ref Net_DVR_FindData);
                             break;
                         case 1001:
                             MessageBox.Show("没有找到文件!");
                             break;
                         case 1002:
                             FindFile = HCNetSDK.NET_DVR_FindNextFile(Findhandle, ref Net_DVR_FindData);
                             break;
                         case 1003:
                             MessageBox.Show("查找完毕!");
                             break;
                         default:
                             MessageBox.Show("查找文件时异常");
                             break;
                     }
                 }

 

你可能感兴趣的:(File)