void CZogvmDlg::OnButtonBuild() { // TODO: Add your control notification handler code here GetDlgItem(IDC_BUTTON_BUILD)->EnableWindow(FALSE); aaaa=GetTickCount(); SQLDB.Begin(); SQLDB.Hdd_SetNonsert(); CDLGHdd::Add27HDDid(); SQLDB.Commit(); hddList.clear(); //几个硬盘开几个线程 SQLDB.Hdd_Read(hddList); bool flag=false; list<struct HDD_ST>::iterator beglist; for(beglist=hddList.begin();beglist!=hddList.end();beglist++) { beglist->dealstep=DEALSTEP_ALL_END; if(beglist->insertflag && beglist->enable) { flag=true; beglist->dealstep=DEALSTEP_START; CreateThread(NULL,0,BuildThreadPROC,(void*)&(*beglist),0,NULL); } } if(false == flag) GetDlgItem(IDC_BUTTON_BUILD)->EnableWindow(TRUE); }
void CDLGhdddelete::OnBnClickedButtonDeleteDouble() { // TODO: Add your control notification handler code here UpdateData(TRUE); SQLDB.Begin(); SQLDB.Double_DeleteAll(); SQLDB.File_CleanDouble2Zero(); SQLDB.Commit(); MessageBox(ConvertString("删除完毕"),NULL); }
void CZogvmDlg::OnBnClickedButtonDouble() { // TODO: Add your control notification handler code here UpdateData(TRUE); SQLDB.File_ResetDouble2Zero(); ListTotal=0; ListTotal=SQLDB.File_DoubleNumber(); ListNow=0; ModeFlag=MODE_DOUBLE; DisplayerList(); }
void CZogvmDlg::OnButtonBuild() { // TODO: Add your control notification handler code here GetDlgItem(IDC_BUTTON_BUILD)->EnableWindow(FALSE); aaaa=GetTickCount(); SQLDB.Begin(); SQLDB.Hdd_SetNonsert(); CDLGHdd::Add27HDDid(); SQLDB.Commit(); CreateThread(NULL,0,BuildThreadPROC,(void*)this,0,NULL); }
void CDLGhdddelete::DisplayerList() { hddList.clear(); SQLDB.Hdd_Read(hddList); m_list.DeleteAllItems(); char str[32]; int i=0; list<struct HDD_ST>::iterator beglist; for(beglist=hddList.begin();beglist!=hddList.end();beglist++) { m_list.InsertItem(i,beglist->serno); m_list.SetItemText(i,1,beglist->area); m_list.SetItemText(i,2,beglist->mark); sprintf(str,"%.3fG",(double)(beglist->TotalBytes/1024/1024)/1024.0); m_list.SetItemText(i,3,str); sprintf(str,"%.3fG",(double)(beglist->FreeBytes/1024/1024)/1024.0); m_list.SetItemText(i,4,str); if(beglist->insertflag) m_list.SetItemText(i,5,ConvertString("接入<--")); else m_list.SetItemText(i,5,ConvertString("脱机-->")); sprintf(str,"%d",beglist->hdd_nid); m_list.SetItemText(i,6,str); m_list.SetItemText(i,7,beglist->format); i++; } }
void CDLGFileType::OnBnClickedButtonRebuild() { // TODO: Add your control notification handler code here SQLDB.Type_DeleteAll(); SQLDB.Type_AddAll(); typeList.clear(); SQLDB.Type_Read(typeList); //初始化列表 DisplayVideoList(); DisplayMusicList(); DisplaySubList(); DisplayOtherList(); }
void CZogvmDlg::OnBnClickedButtonTrashClean() { // TODO: Add your control notification handler code here UpdateData(TRUE); if( MODE_TRASH==ModeFlag) { if(!m_c_delete_trash) { MessageBox("不小心点到的吧?真的要删,请勾选 真的删"); return ; } WinfileviewList.clear(); SQLDB.File_ReadTrash(WinfileviewList,0,PAGE_MAX_NUM); if(WinfileviewList.size()>0) { list<struct FILE_VIEW_ST>::iterator beglist; char str[512]; SQLDB.Begin(); for(beglist=WinfileviewList.begin();beglist!=WinfileviewList.end();beglist++) { if(beglist->hdd_data.insertflag) { sprintf(str,"%s%s%s",beglist->hdd_data.area,beglist->file_data.path,beglist->file_data.name); DeleteFile(str); SQLDB.File_Delete(beglist->file_data.file_nid); } } SQLDB.Commit(); } MessageBox("本页清理完毕"); } else MessageBox("不是 垃圾文件 模式,按钮无效"); m_c_delete_trash=FALSE; UpdateData(FALSE); }
void CDLGhdddelete::OnOK() { // TODO: Add extra validation here UpdateData(TRUE); int i; char str[32]; int check; SQLDB.Begin(); for( i=0;i<m_list.GetItemCount();i++) { m_list.GetItemText(i,6,str,32); check=m_list.GetCheck(i); if(check) { SQLDB.File_DeleteforHdd(_atoi64(str)); SQLDB.Hdd_DeleteforHdd(_atoi64(str)); SQLDB.Dir_DeleteforHdd(_atoi64(str)); } } SQLDB.Commit(); MessageBox(ConvertString("删除完毕"),NULL); hddList.clear(); SQLDB.Hdd_Read(hddList); DisplayerList() ; }
void CZogvmDlg::OnButtonFind() { // TODO: Add your control notification handler code here UpdateData(TRUE); ListTotal=0; memset(SQLstr,0,1024); SQLupdown.type_video=m_c_video; SQLupdown.type_audio=m_c_audio; SQLupdown.type_sub=m_c_sub; SQLupdown.type_other=m_c_other; SQLupdown.point=POINT_PATH; SQLupdown.path=true; SQLupdown.name=false; SQLupdown.creattime=false; SQLupdown.lasttime=false; SQLupdown.filesize=false; SQLupdown.resolution=false; if(m_sreach.IsEmpty()) { SQLupdown.issearch=false; SQLDB.File_filterUpDown(SQLstr,SQLupdown); ListTotal=SQLDB.File_Number(SQLstr); } else { SQLupdown.issearch=true; SQLDB.File_filterUpDown(SQLstr,SQLupdown); ListTotal=SQLDB.File_NumberForSearch(SQLstr,m_sreach.GetBuffer(0)); } ListNow=0; ModeFlag=MODE_FIND; DisplayerList(); }
void CZogvmDlg::OnBnClickedButtonTrash() { // TODO: Add your control notification handler code here UpdateData(TRUE); ListTotal=0; ListTotal=SQLDB.File_TrashNumber(); ListNow=0; ModeFlag=MODE_TRASH; DisplayerList(); }
void CDLGFileType::OnBnClickedButtonNew() { // TODO: Add your control notification handler code here UpdateData(TRUE); if(m_e_new.IsEmpty()) { MessageBox(ConvertString("文件后缀不能为空")); return ; } SQLDB.Type_Add_Lock(m_c_new,m_e_new.GetBuffer(0)); typeList.clear(); SQLDB.Type_Read(typeList); //初始化列表 DisplayVideoList(); DisplayMusicList(); DisplaySubList(); DisplayOtherList(); }
DWORD WINAPI DoubleThreadPROC(LPVOID lpParameter) { list<struct HDD_ST> temphddList; temphddList.clear(); SQLDB.Hdd_Read(temphddList); // CDLGhdddelete *Pdlg=(CDLGhdddelete *)lpParameter; list<struct HDD_ST>::iterator beglist; for(beglist=temphddList.begin();beglist!=temphddList.end();beglist++) { //查看重复文件 CheckAllDoubleFile(beglist->hdd_nid,""); } return 0; }
///////////////////////////////////////////////////////////////////////////// // CDLGFileType message handlers BOOL CDLGFileType::OnInitDialog() { CDialog::OnInitDialog(); typeList.clear(); SQLDB.Type_Read(typeList); //初始化列表 InitVideoList(); DisplayVideoList(); InitMusicList(); DisplayMusicList(); InitSubList(); DisplaySubList(); InitOtherList(); DisplayOtherList(); return TRUE; // return TRUE unless you set the focus to a control }
void CDLGFileType::OnOK() { // TODO: Add extra validation here UpdateData(TRUE); int i; char str[32]; int check; SQLDB.Begin(); for( i=0;i<m_list_video.GetItemCount();i++) { m_list_video.GetItemText(i,1,str,32); check=m_list_video.GetCheck(i); SQLDB.Type_ModifyEnable(str,check); } for( i=0;i<m_list_music.GetItemCount();i++) { m_list_music.GetItemText(i,1,str,32); check=m_list_music.GetCheck(i); SQLDB.Type_ModifyEnable(str,check); } for( i=0;i<m_list_sub.GetItemCount();i++) { m_list_sub.GetItemText(i,1,str,32); check=m_list_sub.GetCheck(i); SQLDB.Type_ModifyEnable(str,check); } for( i=0;i<m_list_other.GetItemCount();i++) { m_list_other.GetItemText(i,1,str,32); check=m_list_other.GetCheck(i); SQLDB.Type_ModifyEnable(str,check); } SQLDB.Commit(); typeList.clear(); CDialog::OnOK(); }
BOOL CZogvmApp::InitInstance() { AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif GetCurrentDirectory(MAX_PATH, CurrentDir); SQLDB.OpenDB("zogvm.db"); SQLDB.ZiDian_CreateTable(); SQLDB.Type_CreateTable(); SQLDB.Type_AddAll(); SQLDB.Hdd_CreateTable(); SQLDB.File_CreateTable(); SQLDB.File_CreateView(); SQLDB.Double_CreateTable(); SQLDB.Begin(); SQLDB.File_SetNoFlagAll(); SQLDB.Hdd_SetNonsert(); CDLGHdd::Add27HDDid(); SQLDB.Commit(); CZogvmDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } SQLDB.CloseDB(); // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
DWORD WINAPI ExeclThreadPROC(LPVOID lpParameter) { char path[260]; strcpy(path,(char *)lpParameter); unsigned short fontsize=256; workbook w; worksheet **sheet; long sheetTotal=0; long long *filenum; xf_t *xf = NULL; int i=0; long j,k,m; SYSTEMTIME systime; FILETIME temptime; ULARGE_INTEGER uli; int ret; char str[2048]; wchar_t wbuff[2048]; list<struct HDD_ST> MyhddList; SQLDB.Hdd_SetNonsert(); CDLGHdd::Add27HDDid(); MyhddList.clear(); SQLDB.Hdd_Read(MyhddList); if(MyhddList.size()<=0) { MessageBox(NULL,"没有硬盘","导出EXECL",MB_OK); return 0; } //导出硬盘 sheetTotal=1; sheet=(worksheet **)calloc(sheetTotal,sizeof(worksheet *)); filenum=(long long *)calloc(MyhddList.size(),sizeof(long long)); xf= w.xformat(); //xf->SetLocked(true) ;无效代码 sheet[0]=w.sheet(L"硬盘目录"); sheet[0]->colwidth(0,10*fontsize); sheet[0]->label(0,0,L"磁盘序列号"); sheet[0]->colwidth(1,10*fontsize); sheet[0]->label(0,1,L"分区"); sheet[0]->colwidth(2,30*fontsize); sheet[0]->label(0,2,L"标签"); sheet[0]->colwidth(3,20*fontsize); sheet[0]->label(0,3,L"总空间"); sheet[0]->colwidth(4,20*fontsize); sheet[0]->label(0,4,L"剩余空间"); list<struct HDD_ST>::iterator beglist; for(i=1,beglist=MyhddList.begin();beglist!=MyhddList.end();i++,beglist++) { MultiByteToWideChar(CP_ACP, 0, beglist->serno, -1, wbuff, 2048); sheet[0]->label(i,0,wbuff); MultiByteToWideChar(CP_ACP, 0, beglist->area, -1, wbuff, 2048); sheet[0]->label(i,1,wbuff); MultiByteToWideChar(CP_ACP, 0, beglist->mark, -1, wbuff, 2048); sheet[0]->label(i,2,wbuff); sprintf(str,"%I64u",beglist->TotalBytes); MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); sheet[0]->label(i,3,wbuff); sprintf(str,"%I64u",beglist->FreeBytes); MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); sheet[0]->label(i,4,wbuff); filenum[i-1]=SQLDB.File_NumberForHDD(beglist->hdd_nid); sheetTotal += (long)(filenum[i-1]/10000) +1; } //导出文件 sheet=(worksheet **)realloc(sheet,sheetTotal*sizeof(worksheet *)); outputList.clear(); list<struct FILE_VIEW_ST>::iterator filebeglist; k=1; for(i=0,beglist=MyhddList.begin();beglist!=MyhddList.end();i++,beglist++) { if(filenum[i] <= 0) continue; for(j=0;j< (long)(filenum[i]/10000) +1;j++) { sprintf(str,"%s %s %d",beglist->serno,beglist->mark,j); MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); sheet[k]=w.sheet(wbuff); sheet[k]->colwidth(0,10*fontsize); sheet[k]->label(0,0,L"序号"); sheet[k]->colwidth(1,150*fontsize); sheet[k]->label(0,1,L"文件路径"); sheet[k]->colwidth(2,5*fontsize); sheet[k]->label(0,2,L"类型"); sheet[k]->colwidth(3,5*fontsize); sheet[k]->label(0,3,L"后缀"); sheet[k]->colwidth(4,20*fontsize); sheet[k]->label(0,4,L"创建时间"); sheet[k]->colwidth(5,20*fontsize); sheet[k]->label(0,5,L"修改时间"); sheet[k]->colwidth(6,15*fontsize); sheet[k]->label(0,6,L"文件大小"); sheet[k]->colwidth(7,10*fontsize); sheet[k]->label(0,7,L"分辨率"); sheet[k]->colwidth(8,5*fontsize); sheet[k]->label(0,8,L"3D"); outputList.clear(); SQLDB.File_ReadHddPage(outputList,beglist->hdd_nid,true,j*10000,10000); if(outputList.size() <= 0) continue; for(m=1,filebeglist=outputList.begin();filebeglist!=outputList.end();m++,filebeglist++) { sprintf(str,"%I64u",filebeglist->file_data.file_nid); MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); sheet[k]->label(m,0,wbuff); sprintf(str,"%s%s",filebeglist->file_data.path,filebeglist->file_data.name); MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); sheet[k]->label(m,1,wbuff); sprintf(str,"%s",MainType2Str(filebeglist->file_data.maintype)); MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); sheet[k]->label(m,2,wbuff); MultiByteToWideChar(CP_ACP, 0, filebeglist->file_data.type, -1, wbuff, 2048); sheet[k]->label(m,3,wbuff); if(filebeglist->file_data.CreationTime) { uli.QuadPart=filebeglist->file_data.CreationTime; temptime.dwLowDateTime=uli.LowPart; temptime.dwHighDateTime=uli.HighPart; FileTimeToSystemTime(&temptime,&systime); sprintf(str,"%04d-%02d-%02d %02d:%02d:%02d", systime.wYear,systime.wMonth,systime.wDay, systime.wHour,systime.wMinute,systime.wSecond); MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); sheet[k]->label(m,4,wbuff); } if(filebeglist->file_data.LastWriteTime) { uli.QuadPart=filebeglist->file_data.LastWriteTime; temptime.dwLowDateTime=uli.LowPart; temptime.dwHighDateTime=uli.HighPart; FileTimeToSystemTime(&temptime,&systime); sprintf(str,"%04d-%02d-%02d %02d:%02d:%02d", systime.wYear,systime.wMonth,systime.wDay, systime.wHour,systime.wMinute,systime.wSecond); MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); sheet[k]->label(m,5,wbuff); } sprintf(str,"%I64u",filebeglist->file_data.filesize); MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); sheet[k]->label(m,6,wbuff); MultiByteToWideChar(CP_ACP, 0, filebeglist->file_data.zidian_fenbianlv , -1, wbuff, 2048); sheet[k]->label(m,7,wbuff); MultiByteToWideChar(CP_ACP, 0, filebeglist->file_data.zidian_3d, -1, wbuff, 2048); sheet[k]->label(m,8,wbuff); } k++; } } MyhddList.clear(); outputList.clear(); MultiByteToWideChar(CP_ACP, 0, path, -1, wbuff, 2048); ret = w.Dump(wbuff); free(filenum); free(sheet); pZogvmDlg->GetDlgItem(IDC_BUTTON_OUTPUTEXECL)->EnableWindow(TRUE); if (ret != 0) { MessageBox(NULL,"导出失败","导出EXECL",MB_OK); return 0; } MessageBox(NULL,"导出完成","导出EXECL",MB_OK); return 0; }
DWORD WINAPI BuildThreadPROC(LPVOID lpParameter) { CZogvmDlg *pDlg=(CZogvmDlg *)lpParameter; char tempstr[256]; pDlg->hddList.clear(); //几个硬盘开几个线程 SQLDB.Hdd_Read(pDlg->hddList); list<struct FILETYPE_ST> typeList; typeList.clear(); SQLDB.Type_Read(typeList); list<struct ZIDIAN_ST> zidianList; zidianList.clear(); SQLDB.ZiDian_Read(zidianList); list<struct HDD_ST>::iterator beglist; for(beglist=pDlg->hddList.begin();beglist!=pDlg->hddList.end();beglist++) { if(beglist->insertflag && beglist->enable) { sprintf(tempstr,ConvertString("%s %s :建目录中.."),beglist->serno,beglist->mark); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); //建目录 FindAllFile_NEW(beglist->hdd_nid,beglist->area,typeList,zidianList); //缺少 关联 IDX代码 SQLDB.File_CleanIDX(beglist->hdd_nid); sprintf(tempstr,ConvertString("%s %s :判断文件是否存在.."),beglist->serno,beglist->mark); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); //查看文件是否存在 CheckAllIsFile(beglist->hdd_nid); } } for(beglist=pDlg->hddList.begin();beglist!=pDlg->hddList.end();beglist++) { if(beglist->insertflag && beglist->enable) { sprintf(tempstr,ConvertString("%s %s :判断重复文件.."),beglist->serno,beglist->mark); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); //查看重复文件 CheckAllDoubleFile(beglist->hdd_nid); } } bbbb=GetTickCount()-aaaa; sprintf(tempstr,ConvertString("全部扫描完毕~么么哒 耗时%I64u分钟"),bbbb/60000); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); pZogvmDlg->GetDlgItem(IDC_BUTTON_BUILD)->EnableWindow(TRUE); return 0; }
DWORD WINAPI BuildThreadPROC(LPVOID lpParameter) { struct HDD_ST hddst; memcpy(&hddst,(struct HDD_ST *)lpParameter,sizeof(struct HDD_ST)); char tempstr[256]; list<struct FILETYPE_ST> typeList; typeList.clear(); SQLDB.Type_Read(typeList); list<struct ZIDIAN_ST> zidianList; zidianList.clear(); SQLDB.ZiDian_Read(zidianList); sprintf(tempstr,"%s %s :建目录中..",hddst.serno,hddst.mark); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); //建目录 FindAllFile(hddst.hdd_nid,hddst.area,typeList,zidianList); sprintf(tempstr,"%s %s :判断文件是否存在..",hddst.serno,hddst.mark); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); //缺少 关联 IDX代码 SQLDB.File_CleanIDX(hddst.hdd_nid); //查看文件是否存在 CheckAllIsFile(hddst.hdd_nid); //设置自己查找完毕 list<struct HDD_ST>::iterator beglist; for(beglist=pZogvmDlg->hddList.begin();beglist!=pZogvmDlg->hddList.end();beglist++) { if(beglist->hdd_nid == hddst.hdd_nid) { beglist->dealstep=DEALSTEP_FIND_END; break; } } //判断是否全部完结 bool flag=true; //等待全部完结后 查重 while(flag) { flag=false; for(beglist=pZogvmDlg->hddList.begin();beglist!=pZogvmDlg->hddList.end();beglist++) { if(DEALSTEP_START == beglist->dealstep) { flag=true; Sleep(1000); break; } } } sprintf(tempstr,"%s %s :判断重复文件..",hddst.serno,hddst.mark); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); //查看重复文件 CheckAllDoubleFile(hddst.hdd_nid); sprintf(tempstr,"%s %s :扫描完毕",hddst.serno,hddst.mark); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); //设置自己完毕 for(beglist=pZogvmDlg->hddList.begin();beglist!=pZogvmDlg->hddList.end();beglist++) { if(beglist->hdd_nid == hddst.hdd_nid) { beglist->dealstep=DEALSTEP_ALL_END; break; } } //判断是否全部完结 flag=true; for(beglist=pZogvmDlg->hddList.begin();beglist!=pZogvmDlg->hddList.end();beglist++) { if(DEALSTEP_ALL_END != beglist->dealstep) { flag=false; break; } } if(flag) { bbbb=GetTickCount()-aaaa; sprintf(tempstr,"全部扫描完毕~么么哒 耗时%I64u分钟",bbbb/60000); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); pZogvmDlg->GetDlgItem(IDC_BUTTON_BUILD)->EnableWindow(TRUE); } return 0; }
void CZogvmDlg::DisplayerList() { m_list.DeleteAllItems(); WinfileviewList.clear(); if(0==ListTotal) { GetDlgItem(IDC_STATIC_INFO)->SetWindowText("共0条 1/1页"); InvalidateRect(printf_Rect, TRUE); return ; } unsigned long int si,ei; si=ListNow+1; if((ListNow+PAGE_MAX_NUM) < ListTotal) ei=ListNow+PAGE_MAX_NUM ; else ei=ListTotal; switch(ModeFlag) { case MODE_DOUBLE: SQLDB.File_ReadDouble(WinfileviewList,si-1,ei-(si-1)); break; case MODE_FIND: if(m_sreach.IsEmpty()) SQLDB.File_Read(SQLstr,WinfileviewList,si-1,ei-(si-1)); else SQLDB.File_ReadForSearch(SQLstr,m_sreach.GetBuffer(0),WinfileviewList,si-1,ei-(si-1)); break; case MODE_TRASH: SQLDB.File_ReadTrash(WinfileviewList,si-1,ei-(si-1)); break; default:return ; } if(WinfileviewList.size()<=0) return ; list<struct FILE_VIEW_ST>::iterator beglist; char str[128]; int i=0; SYSTEMTIME systime; FILETIME temptime; ULARGE_INTEGER uli; for(beglist=WinfileviewList.begin();beglist!=WinfileviewList.end();beglist++) { //带复选框 LVS_EX_CHECKBOXES if(MAINTYPE_OTHER == beglist->file_data.maintype ) { m_list.InsertItem( i,beglist->hdd_data.serno,5); } else if( MAINTYPE_SUB == beglist->file_data.maintype) { m_list.InsertItem( i,beglist->hdd_data.serno,4); } else if(MAINTYPE_VIDEO == beglist->file_data.maintype ) { m_list.InsertItem( i,beglist->hdd_data.serno,2); } else if(MAINTYPE_MUSIC == beglist->file_data.maintype ) { m_list.InsertItem( i,beglist->hdd_data.serno,3); } m_list.SetItemText(i,1,beglist->hdd_data.mark); m_list.SetItemText(i,2,beglist->hdd_data.area); sprintf(str,"%I64u",beglist->file_data.file_nid); m_list.SetItemText(i,3,str); m_list.SetItemText(i,4,beglist->file_data.path); m_list.SetItemText(i,5,beglist->file_data.name); m_list.SetItemText(i,6, MainType2Str(beglist->file_data.maintype)); m_list.SetItemText(i,7,beglist->file_data.type); if(beglist->file_data.CreationTime) { uli.QuadPart=beglist->file_data.CreationTime; temptime.dwLowDateTime=uli.LowPart; temptime.dwHighDateTime=uli.HighPart; FileTimeToSystemTime(&temptime,&systime); sprintf(str,"%04d-%02d-%02d %02d:%02d:%02d", systime.wYear,systime.wMonth,systime.wDay, systime.wHour,systime.wMinute,systime.wSecond); m_list.SetItemText(i,8,str); } if(beglist->file_data.LastWriteTime) { uli.QuadPart=beglist->file_data.LastWriteTime; temptime.dwLowDateTime=uli.LowPart; temptime.dwHighDateTime=uli.HighPart; FileTimeToSystemTime(&temptime,&systime); sprintf(str,"%04d-%02d-%02d %02d:%02d:%02d", systime.wYear,systime.wMonth,systime.wDay, systime.wHour,systime.wMinute,systime.wSecond); m_list.SetItemText(i,9,str); } //sprintf(str,"%I64u",); DisplaySize(beglist->file_data.filesize,str); m_list.SetItemText(i,10,str); if(beglist->file_data.resolutionW && beglist->file_data.resolutionH) { sprintf(str,"%d*%d",beglist->file_data.resolutionW,beglist->file_data.resolutionH); m_list.SetItemText(i,11,str); } else m_list.SetItemText(i,11,""); if(beglist->file_data.filetime) { sprintf(str,"%d:%02d:%02d", beglist->file_data.filetime / 3600, (beglist->file_data.filetime % 3600) / 60, beglist->file_data.filetime % 60); m_list.SetItemText(i,12,str); } else m_list.SetItemText(i,12,""); if(beglist->hdd_data.insertflag) { m_list.SetItemText(i,13,"接入"); m_list.SetItem(i, 13, LVIF_IMAGE, NULL, 0, 0, 0, 0); } else { m_list.SetItemText(i,13,"脱机"); m_list.SetItem(i, 13, LVIF_IMAGE, NULL, 1, 0, 0, 0); } /* //名称 LV_ITEM lvitem; memset ((char *) &lvitem, 0, sizeof (LV_ITEM)); lvitem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvitem.iItem = i; lvitem.iSubItem = 12; lvitem.stateMask = 0; lvitem.iImage =1; //显示不同的图标时,可以把一个int 变量赋给这个属性值 lvitem.pszText = "a"; m_list.SetItem (&lvitem); m_list.SetItem(i, 12, LVIF_IMAGE, NULL, 0, 0, 0, 0); */ m_list.SetItemText(i,14,beglist->file_data.zidian_3d); m_list.SetItemText(i,15,beglist->file_data.zidian_huazhi); m_list.SetItemText(i,16,beglist->file_data.zidian_fenbianlv); m_list.SetItemText(i,17,beglist->file_data.zidian_yazhi); m_list.SetItemText(i,18,beglist->file_data.zidian_year); m_list.SetItemText(i,19,beglist->file_data.md5); if(MODE_DOUBLE == ModeFlag) { sprintf(str,"%I64u",beglist->file_data.double_nid); m_list.SetItemText(i,20,str); } else m_list.SetItemText(i,20,"0"); i++; } if(ListTotal%PAGE_MAX_NUM) { sprintf(str,"共%d条 %d/%d页 每页%d条", ListTotal, ListNow/PAGE_MAX_NUM+1,ListTotal/PAGE_MAX_NUM+1,PAGE_MAX_NUM); } else { sprintf(str,"共%d条 %d/%d页 每页%d条", ListTotal, ListNow/PAGE_MAX_NUM+1,ListTotal/PAGE_MAX_NUM,PAGE_MAX_NUM); } GetDlgItem(IDC_STATIC_INFO)->SetWindowText(str); InvalidateRect(printf_Rect, TRUE); m_c_delete_trash=FALSE; UpdateData(FALSE); }
BOOL CBarcodeRecordApp::InitInstance() { // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif //读系统配置表 Set_AllPath(); DlgSettings.Read2Dlg(); //打开数据库 int Error = SQLiteIO.ConnectionDataBase("DataBaseConfig.txt"); if(Error == ReadFile_FAIL) { // CDLGWarnning dlgw; // dlgw.m_wintxt=Language_ConvertString("Connect Database"); //窗口标题 // dlgw.m_warntxt=Language_ConvertString("Conn't Read Database Config"); //窗口内容 // dlgw.DoModal(); return FALSE; } else if(Error == Instance_FAIL) { // CDLGWarnning dlgw; // dlgw.m_wintxt=Language_ConvertString("Connect Database"); //窗口标题 // dlgw.m_warntxt=Language_ConvertString("Initialization ADO failed"); //窗口内容 // dlgw.DoModal(); return FALSE; } else if(Error == ContOpen_FAIL) { // CDLGWarnning dlgw; // dlgw.m_wintxt=Language_ConvertString("Connect Database"); //窗口标题 // dlgw.m_warntxt=Language_ConvertString("Connet Database Failed"); //窗口内容 // dlgw.DoModal(); return FALSE; } else if(Error == Connectd_DONE) { // CDLGWarnning dlgw; // dlgw.m_wintxt=Language_ConvertString("Connect Database"); //窗口标题 // dlgw.m_warntxt=Language_ConvertString("Connect Database Successfully"); //窗口内容 // dlgw.DoModal(); } CBarcodeRecordDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
//列头点击事件 void CZogvmDlg::OnLvnColumnclickList(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR); // TODO: 在此添加控件通知处理程序代码 int sort_column = pNMLV->iSubItem;//点击的列 UpdateData(TRUE); if(MODE_FIND ==ModeFlag ) { switch(sort_column) { case 4: SQLupdown.point=POINT_PATH; SQLupdown.path=!SQLupdown.path; break; case 5: SQLupdown.point=POINT_NAME; SQLupdown.name=!SQLupdown.name; break; case 8: SQLupdown.point=POINT_CREATTIME; SQLupdown.creattime=!SQLupdown.creattime; break; case 9: SQLupdown.point=POINT_LASTTIME; SQLupdown.lasttime=!SQLupdown.lasttime; break; case 10: SQLupdown.point=POINT_FILESIZE; SQLupdown.filesize=!SQLupdown.filesize; break; case 16: SQLupdown.point=POINT_RESOLUTION; SQLupdown.resolution=!SQLupdown.resolution; break; default:return ; } ListTotal=0; memset(SQLstr,0,1024); SQLupdown.type_video=m_c_video; SQLupdown.type_audio=m_c_audio; SQLupdown.type_sub=m_c_sub; SQLupdown.type_other=m_c_other; if(m_sreach.IsEmpty()) { SQLupdown.issearch=false; SQLDB.File_filterUpDown(SQLstr,SQLupdown); ListTotal=SQLDB.File_Number(SQLstr); } else { SQLupdown.issearch=true; SQLDB.File_filterUpDown(SQLstr,SQLupdown); ListTotal=SQLDB.File_NumberForSearch(SQLstr,m_sreach.GetBuffer(0)); } ListNow=0; ModeFlag=MODE_FIND; DisplayerList(); } // TODO: Add your control notification handler code here *pResult = 0; }