void CoptimizerDlg::OnBnClickedButton1() { CButton *OptimizeButton = (CButton*)GetDlgItem(IDC_BUTTON1); CButton *CancelButton = (CButton*)GetDlgItem(IDCANCEL); CProgressCtrl *ProgressBar = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS); int RetVal; OptimizeButton->SetWindowText(TEXT("Please wait...")); OptimizeButton->EnableWindow(FALSE); CancelButton->EnableWindow(FALSE); ProgressBar->SetPos(0); OptimizeBoot(OptimizeButton); #ifndef LDRONLY ProgressBar->SetPos(25); OptimizeRegistry(OptimizeButton); ProgressBar->SetPos(50); OptimizeLibraries(OptimizeButton); ProgressBar->SetPos(75); OptimizeSystem(OptimizeButton); #endif ProgressBar->SetPos(100); OptimizeButton->SetWindowText(TEXT("Optimize!")); OptimizeButton->EnableWindow(TRUE); CancelButton->EnableWindow(TRUE); RetVal = MessageBox(TEXT("You need to reboot the system for the changes to take effect. Reboot now?"), TEXT("Done."), MB_OKCANCEL); if(RetVal == IDOK) Reboot(); else InflictLoad(); }
void DialogView::updateBeat() { CProgressCtrl* pProgressCtrl = (CProgressCtrl*) GetDlgItem(IDC_BEAT_BAR); pProgressCtrl->SetPos(100); int wait = 25; HANDLE waitEvent = CreateEvent(0, TRUE, FALSE, NULL); WaitForSingleObject(waitEvent, wait); CloseHandle(waitEvent); pProgressCtrl->SetPos(0); }
void CListCtrlEx::InsertProgresCtrl(int iIndex, int iStatus) { CHeaderCtrl* pHeader = GetHeaderCtrl(); CRect ColRt; pHeader->GetItemRect(m_iProgressColumn, &ColRt); //get the rect CRect rt; GetItemRect(iIndex, &rt, LVIR_LABEL); rt.top += 1; rt.bottom -= 1; rt.left += ColRt.left; int Width = ColRt.Width(); rt.right = rt.left + Width - 4; rt.left = ColRt.left+1; rt.right = ColRt.right-1; CProgressCtrl *pControl = new CProgressCtrl; pControl->Create(WS_CHILD|WS_VISIBLE, rt, this, IDC_PROGRESS_LIST + iIndex); pControl->SetRange(0, 100); pControl->SetPos(iStatus); pControl->ShowWindow(SW_SHOWNOACTIVATE); //add them to the list m_ProgressList.push_back(pControl); }
// CCalculate-Meldungshandler void CCalculate::OnBnClickedOk() { canClose = false; //wait until all threads have terminated and memory has been freed isRunning = true; // operation is runing and can be stopped by the user isError = false; GetDlgItem(IDOK)->EnableWindow(false); num_cpu = Ccpuinfo::get_num_cpu(); timelist_position = m_position; pi_digits = m_digits; m_text.Format(_T("Calculating %i digits of Pi with %i threads.\r\nPress \"Stop / Close\" to cancel calculation."), pi_digits, num_cpu); UpdateData(false); CProgressCtrl *progressBar = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS1); //SetRange() has only support for short! SetRange32 supports 32bit integer! progressBar->SetRange32(0, pi_digits/TRUSTED); progressBar->SetPos(0); if(pi_digits <= 8000) myTimer = SetTimer(1, 1000, 0); else myTimer = SetTimer(1, 2000, 0); CCalculate myThread; AfxBeginThread(CCalculate::Control_Thread, reinterpret_cast<LPVOID>(&myThread), THREAD_PRIORITY_NORMAL, 0, 0, NULL); }
STDMETHODIMP CAtlBase::ShowProgressForm(LONG bShow) { if (bShow) { if (!g_bProgressInited) { g_bProgressInited = TRUE; g_ProgressDlg.Create(NULL); g_ProgressDlg.CenterWindow(); HWND hName = g_ProgressDlg.GetDlgItem(IDC_STATIC_NAME); g_ProgressName.Attach(hName); HWND hProgress = g_ProgressDlg.GetDlgItem(IDC_PROGRESS1); g_ProgressProgress.Attach(hProgress); } g_ProgressDlg.ShowWindow(SW_SHOW); } else { g_ProgressDlg.ShowWindow(SW_HIDE); g_ProgressName.SetWindowText(""); g_ProgressProgress.SetPos(0); } return S_OK; }
void CBackEndDialog::SetTaskProgress(float fProgress) { //get the progress bar control CProgressCtrl* pProgress = ((CProgressCtrl*)GetDlgItem(IDC_PROGRESS_TASK)); //set the position (*10 is since it takes integers, and the range is //0 to 1000 for the bar, and 0 to 100 for the progress var (gives finer //granularity)) pProgress->SetPos((int)(fProgress * 10)); //we also want to update the title bar if(m_sSubTaskName.GetLength() > 0) { if(IsIconic()) { CString sTitle; sTitle.Format("%d%% of %s - %s", (int)fProgress, m_sSubTaskName, m_sFilename); //we want to avoid changing the text a whole lot since it causes flickering, so //make sure that the text is actually different CString sOldTitle; GetWindowText(sOldTitle); if(sOldTitle != sTitle) { SetWindowText(sTitle); } } } }
PUBLIC BOOL UserProgress (HTRequest * request, HTAlertOpcode op, int msgnum, const char * dfault, void * input, HTAlertPar * reply) { char * msg = HTDialog_progressMessage(request, op, msgnum, dfault, input); CRequest * req = (CRequest *) HTRequest_context(request); ASSERT(request != NULL); ASSERT(req != NULL); CProgressCtrl * progress = req->GetProgressBar(); switch (op) { case HT_PROG_READ: { long cl = HTAnchor_length(HTRequest_anchor(request)); if (cl > 0) { long b_read = HTRequest_bodyRead(request); double pro = (double) b_read/cl*100; progress->SetPos((int) pro); } } break; case HT_PROG_WRITE: { long cl = HTAnchor_length(HTRequest_entityAnchor(request)); if (cl > 0) { long b_written = HTRequest_bodyWritten(request); double pro = (double) b_written/cl*100; progress->SetPos((int) pro); } } break; } // Update pane 0 of the status bar if (msg) { CWinComDoc * doc = req->m_pDoc; if (doc) { POSITION pos = doc->GetFirstViewPosition(); CView * view = doc->GetNextView( pos ); CMainFrame * mainframe = (CMainFrame *) view->GetParentFrame(); mainframe->m_wndStatusBar.SetPaneText(ID_SEPARATOR, msg); } HT_FREE(msg); } return YES; }
void AFXAPI CBaseDlg::DDX_Progress(CDataExchange* pDX, int nIDC, int& value) { CProgressCtrl* ctl = (CProgressCtrl*)pDX->m_pDlgWnd->GetDlgItem(nIDC); if (pDX->m_bSaveAndValidate) value = ctl->GetPos(); else ctl->SetPos(value); }
void CMainFrame::OnBnClickedButton2() { CProgressCtrl* progress = (CProgressCtrl*) m_wndDlgBar.GetDlgItem(IDC_PROGRESS1); int pos = progress->GetPos() - 10; if (pos < 0) pos = 0; progress->SetPos(pos); }
void CIwProgressPropertyPage::UpdateProgress(int nTotal, int nProcessed, const CString& sSupplierName) { CProgressCtrl* ctlProgress = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS); ASSERT(ctlProgress != 0); CWnd* pWnd = GetDlgItem(IDC_STATIC_PROCESSED); ASSERT(pWnd != 0); CWnd* pManager = GetDlgItem(IDC_STATIC_MANAGER); ASSERT(pManager != 0); if (nTotal == -1) { ctlProgress->SetPos(0); CString sStatus = LS (L_PROCESSED_LABEL); pWnd->SetWindowText(sStatus); pManager->SetWindowText(sSupplierName); return; } int nPos; if (nProcessed == nTotal) { nPos = 100; } else { assert (nTotal != 0); nPos = (100 * nProcessed) / nTotal; } ctlProgress->SetPos(nPos); CString sManager; pManager->GetWindowText(sManager); if (sManager.Compare(sSupplierName) != 0) { pManager->SetWindowText(sSupplierName); } CString sStatus = LS (L_PROCESSED_LABEL); sStatus += " "; CString sTmp; CString sFmt = LS (L_PART_OF_TOTAL_FMT); sTmp.Format(sFmt, nProcessed, nTotal); sStatus += sTmp; pWnd->SetWindowText(sStatus); }
void CCalculate::OnTimer(UINT pParam) { CProgressCtrl *progressBar = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS1); //progressBar->SetRange(0, m_digits/TRUSTED); progressBar->SetPos(position); if(canClose) { CString fin; fin.Format(_T("Finished calculation!\r\nCalculated %i digits of Pi in %.3lf sec.\r\nPress \"Stop / Close\" to close this window,\r\nor \"Start\" to begin once again."), pi_digits, diff); m_text = fin; UpdateData(false); GetDlgItem(IDOK)->EnableWindow(true); } }
///////////////////////////////////////////////////////////////////////////// // CADDigitView drawing void CADDigitView::OnDraw(CDC* pDC) { ADDigit(pDC); if (gl_bProgress) // 刷新ADDigitView视图时,更新进度条的状态 { if (!gl_bDeviceADRun) // 检查是否设备 { return; } CADFrm* pADFrm = ((CSysApp*)AfxGetApp())->m_ADFrm; // 取得子帧窗口句柄 CProgressCtrl* pProgress = (CProgressCtrl*)(pADFrm->m_wndShowStatus.GetDlgItem(IDC_PROGRESS)); pProgress->SetPos(m_CurrentProgress); m_CurrentProgress++; if (m_CurrentProgress > 50) m_CurrentProgress = 0; gl_bProgress = FALSE; } }
BOOL CIwProgressPropertyPage::OnInitDialog() { CProgressCtrl* ctlProgress = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS); ctlProgress->SetRange(0, 100); ctlProgress->SetPos(1); CPropertySheet* parent = (CPropertySheet*)GetParent(); parent->PostMessage(PSM_PRESSBUTTON, PSBTN_NEXT, 0); CWnd* pwndNextBut = parent->GetDlgItem(ID_WIZNEXT); CWnd* pwndCancelBut = parent->GetDlgItem(IDCANCEL); if (pwndNextBut) pwndNextBut->EnableWindow(0); if (pwndCancelBut) pwndCancelBut->EnableWindow(0); return TRUE; }
void CListCtrlEx::OnPaint() { int i; int Top = GetTopIndex(); int Total = GetItemCount(); int PerPage = GetCountPerPage(); int Last = ((Top+PerPage) > Total)? Total : Top+PerPage; int Count = m_ProgressList.GetSize(); CProgressCtrl* pCtrl; if ((Last-Top) > Count) { for (i = Count; i < Last-Top; i++) { pCtrl = new CProgressCtrl(); CRect rt(1,1,1,1); pCtrl->Create(NULL, rt, this, IDC_PROGRESS_LIST+i); m_ProgressList.Add(pCtrl); } } CHeaderCtrl* pHeader = GetHeaderCtrl(); for (i = Top; i < Last; i++) { CRect ColRt; pHeader->GetItemRect(m_ProgressColumn, &ColRt); CRect rt; GetItemRect(i, &rt, LVIR_LABEL); rt.top += 1; rt.bottom -= 1; rt.left += ColRt.left; rt.right = rt.left + ColRt.Width() - 4; pCtrl = m_ProgressList.GetAt(i-Top); CString strPercent = GetItemText(i, m_ProgressColumn); int nPercent = atoi(strPercent); pCtrl->SetPos(nPercent); pCtrl->MoveWindow(&rt); pCtrl->ShowWindow(SW_SHOWNORMAL); } CListCtrl::OnPaint(); }
void CDBFExplorerDoc::ExportToHTML(LPCTSTR lpszFileName) { USES_CONVERSION; try { CFile file; CString strHTML; // Create "progress bar" CProgressCtrl wndProgress; GetActiveFrame()->ShowProgressBar(&wndProgress, _T("Exporting records, press Esc to cancel...")); // Initialize progress control range and step size wndProgress.SetRange(0, 100); int nCount = m_dBaseFile->GetRecordCount(); if (file.Open(lpszFileName, CFile::modeWrite | CFile::shareExclusive | CFile::modeCreate, NULL)) { strHTML = "<HTML>\r\n"; file.Write(strHTML, strHTML.GetLength()); strHTML = "<HEAD>\r\n"; file.Write(strHTML, strHTML.GetLength()); strHTML = "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;charset=windows-1252\">\r\n"; file.Write(strHTML, strHTML.GetLength()); strHTML.Format(_T("<TITLE>%s</TITLE>\r\n"), GetTitle()); file.Write(strHTML, strHTML.GetLength()); strHTML = "</HEAD>\r\n"; file.Write(strHTML, strHTML.GetLength()); strHTML = "<BODY>\r\n"; file.Write(strHTML, strHTML.GetLength()); strHTML.Format(_T("<TABLE BORDER=1 BGCOLOR=#FFFFFF CELLSPACING=0><FONT FACE=\"Arial\" COLOR=#000000><CAPTION><B>%s</B></CAPTION></FONT>\r\n"), GetTitle().operator LPCTSTR()); file.Write(strHTML, strHTML.GetLength()); strHTML = "<THEAD>\r\n<TR>\r\n"; file.Write(strHTML, strHTML.GetLength()); // show fieldnames for (size_t i = 0; i < m_dBaseFile->GetFieldCount(); i++) { DBF_FIELD_INFO info; if (m_dBaseFile->GetFieldInfo(i, &info)) { strHTML.Format(_T("<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE=\"Arial\" COLOR=#000000>%s</FONT></TH>\r\n"), A2CT(info.name)); file.Write(strHTML, strHTML.GetLength()); } } strHTML = "</TR>\r\n</THEAD>\r\n\r\n<TBODY>\r\n"; file.Write(strHTML, strHTML.GetLength()); // show all records for(int rc=m_dBaseFile->GetFirstRecord(); rc==DBASE_SUCCESS; rc=m_dBaseFile->GetNextRecord()) { // Test for "Esc" key if( ::GetAsyncKeyState(VK_ESCAPE) < 0) { break; } int nItem = m_dBaseFile->GetPosition(); // do not show deleted records if (m_dBaseFile->IsRecordDeleted() && !GetActiveFrame()->m_bShowDeletedRecords) continue; strHTML = "<TR VALIGN=TOP>\r\n"; file.Write(strHTML, strHTML.GetLength()); for (size_t i = 0; i < m_dBaseFile->GetFieldCount(); i++) { CString szBuff; DBF_FIELD_INFO info; m_dBaseFile->GetFieldInfo(i, &info); if (info.type == DBF_DATA_TYPE_MEMO) { szBuff = _T("MEMO"); } else { m_dBaseFile->Read(i, &szBuff); } strHTML.Format(_T("<TD BORDERCOLOR=#c0c0c0 ><FONT SIZE=2 FACE=\"Arial\" COLOR=#000000>%s</FONT></TD>\r\n"), szBuff.operator LPCTSTR()); file.Write(strHTML, strHTML.GetLength()); } strHTML = "</TR>\r\n"; file.Write(strHTML, strHTML.GetLength()); // Update progress control int nPos = (nItem*100)/nCount; wndProgress.SetPos(nPos); } strHTML = "</TBODY>\r\n<TFOOT></TFOOT>\r\n</TABLE>\r\n"; file.Write(strHTML, strHTML.GetLength()); strHTML = "</BODY>\r\n"; file.Write(strHTML, strHTML.GetLength()); strHTML = "</HTML>\r\n"; file.Write(strHTML, strHTML.GetLength()); } } catch(CFileException *e) { e->Delete(); MessageBox(GetFocus(), _T("Failed to export database!"), _T("Export Database"), MB_OK | MB_ICONSTOP); } // Ensures that idle message is displayed again GetActiveFrame()->PostMessage(WM_SETMESSAGESTRING, (WPARAM) AFX_IDS_IDLEMESSAGE, 0L); }
void CInstallerUninstallPage::SetProgress (int iPos) { CProgressCtrl *pProgressCtrl = (CProgressCtrl*)GetDlgItem (IDC_UNINSTALL_PAGE_PROGRESS1); pProgressCtrl->SetPos (iPos); Sleep (100); }
void CItemShopLogCommand::Parse( const MSGROOT* message, CListCtrl& listCtrl, CProgressCtrl& progressCtrl, CStatic& resultStatic, CButton& findButton, CButton& stopButton ) const { switch( message->Protocol ) { case MP_RM_ITEM_SHOP_LOG_ACK: { const MSG_RM_ITEM_SHOP_LOG* m = ( MSG_RM_ITEM_SHOP_LOG* )message; if( m->mRequestTick != mTickCount ) { break; } // 080401 LUJ, 이전 로그에 대한 인덱스 세트를 만들어 중복되지 않도록 체크한다 std::set< DWORD > indexSet; { for( int row = 0; row < listCtrl.GetItemCount(); ++row ) { indexSet.insert( _ttoi( listCtrl.GetItemText( row, 0 ) ) ); } } for( DWORD i = 0; i < m->mSize; ++i ) { const MSG_RM_ITEM_SHOP_LOG::Log& data = m->mLog[ i ]; const DWORD row = listCtrl.GetItemCount(); int step = 0; if( indexSet.end() != indexSet.find( data.mIndex ) ) { continue; } CString text; text.Format( _T( "%d" ), data.mIndex ); listCtrl.InsertItem( row, text, 0 ); listCtrl.SetItemText( row, ++step, CA2WEX< sizeof( data.mDate ) >( data.mDate ) ); listCtrl.SetItemText( row, ++step, mApplication.GetText( data.mType ) ); text.Format( _T( "%d" ), data.mUser.mIndex ); listCtrl.SetItemText( row, ++step, text ); listCtrl.SetItemText( row, ++step, CA2WEX< sizeof( data.mUser.mId ) >( data.mUser.mId ) ); listCtrl.SetItemText( row, ++step, mApplication.GetItemName( data.mItem.mIndex ) ); text.Format( _T( "%d" ), data.mItem.mDbIndex ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), data.mItem.mQuantity ); listCtrl.SetItemText( row, ++step, text ); } { int minRange; int maxRange; progressCtrl.GetRange( minRange, maxRange ); progressCtrl.SetPos( progressCtrl.GetPos() + m->mSize ); CString text; text.Format( _T( "%d/%d" ), progressCtrl.GetPos(), maxRange ); resultStatic.SetWindowText( text ); // 080523 LUJ, 버튼 활성화 체크가 정상적으로 되도록 수정함 if( progressCtrl.GetPos() == maxRange ) { findButton.EnableWindow( TRUE ); stopButton.EnableWindow( FALSE ); } } break; } case MP_RM_ITEM_SHOP_LOG_SIZE_ACK: { const MSG_DWORD* m = ( MSG_DWORD* )message; const DWORD size = m->dwData; CString text; text.Format( _T( "0/%d" ), size ); resultStatic.SetWindowText( text ); progressCtrl.SetRange32( 0, size ); progressCtrl.SetPos( 0 ); findButton.EnableWindow( FALSE ); stopButton.EnableWindow( TRUE ); listCtrl.DeleteAllItems(); break; } case MP_RM_ITEM_SHOP_LOG_SIZE_NACK: { CString textThereIsNoResult; textThereIsNoResult.LoadString( IDS_STRING1 ); MessageBox( 0, textThereIsNoResult, _T( "" ), MB_ICONERROR | MB_OK ); break; } case MP_RM_ITEM_SHOP_LOG_STOP_ACK: { findButton.EnableWindow( TRUE ); stopButton.EnableWindow( FALSE ); CString textSearchWasStopped; textSearchWasStopped.LoadString( IDS_STRING2 ); MessageBox( 0, textSearchWasStopped, _T( "" ), MB_ICONERROR | MB_OK ); break; } case MP_RM_ITEM_SHOP_LOG_NACK_BY_AUTH: { CString textYouHaveNoAuthority; textYouHaveNoAuthority.LoadString( IDS_STRING18 ); MessageBox( 0, textYouHaveNoAuthority, _T( "" ), MB_OK | MB_ICONERROR ); break; } default: { ASSERT( 0 ); break; } } }
void CFarmLogCommand::Parse( const MSGROOT* message, CListCtrl& listCtrl, CProgressCtrl& progressCtrl, CStatic& resultStatic, CButton& findButton, CButton& stopButton ) const { switch( message->Protocol ) { case MP_RM_FARM_LOG_ACK: { // 080401 LUJ, 이전 로그에 대한 인덱스 세트를 만들어 중복되지 않도록 체크한다 std::set< DWORD > indexSet; { for( int row = 0; row < listCtrl.GetItemCount(); ++row ) { indexSet.insert( _ttoi( listCtrl.GetItemText( row, 0 ) ) ); } } const MSG_RM_FARM_LOG* m = ( MSG_RM_FARM_LOG* )message; if( m->mRequestTick != mTickCount ) { break; } for( DWORD i = 0; i < m->mSize; ++i ) { const MSG_RM_FARM_LOG::Log& data = m->mLog[ i ]; const DWORD row = listCtrl.GetItemCount(); int step = 0; if( indexSet.end() != indexSet.find( data.mIndex ) ) { continue; } CString text; text.Format( _T( "%d" ), data.mIndex ); listCtrl.InsertItem( row, text, 0 ); listCtrl.SetItemText( row, ++step, CA2WEX< sizeof( data.mDate ) >( data.mDate ) ); listCtrl.SetItemText( row, ++step, mApplication.GetText( FARM_LOG_KIND( data.mKind ) ) ); text.Format( _T( "%d" ), data.mFarmIndex ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), data.mZone ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), data.mPlayerIndex ); listCtrl.SetItemText( row, ++step, text ); // 080423 LUJ, 농장 개선 로그일 때는 값에 표시 // // 주의: 로그가 잘못 표시되고 있음. 소스를 고치면 기존 로그가 손상되므로, 복구툴에서 정정함 // 이에 따라 로그 타입과 실제 표시되는 텍스트가 다를 수 있음 // // 정원 -> 정원, 울타리 -> 축사, 집 -> 울타리, 창고 -> 집, 축사 -> 창고 if( FARM_LOG_KIND_UPGRADE == data.mKind ) { switch( data.mValue1 ) { case FARM_UPGRADE_LOG_KIND_GARDEN: { CString textGarden; textGarden.LoadString( IDS_STRING368 ); listCtrl.SetItemText( row, ++step, textGarden ); break; } case FARM_UPGRADE_LOG_KIND_FENCE: { CString textCage; textCage.LoadString( IDS_STRING367 ); listCtrl.SetItemText( row, ++step, textCage ); break; } case FARM_UPGRADE_LOG_KIND_HOUSE: { CString textFence; textFence.LoadString( IDS_STRING366 ); listCtrl.SetItemText( row, ++step, textFence ); break; } case FARM_UPGRADE_LOG_KIND_WAREHOUSE: { CString textHouse; textHouse.LoadString( IDS_STRING369 ); listCtrl.SetItemText( row, ++step, textHouse ); break; } case FARM_UPGRADE_LOG_KIND_ANIMALCAGE: { CString textWarehouse; textWarehouse.LoadString( IDS_STRING282 ); listCtrl.SetItemText( row, ++step, textWarehouse ); break; } default: { listCtrl.SetItemText( row, ++step, _T( "?" ) ); break; } } } else { text.Format( _T( "%d" ), data.mValue1 ); listCtrl.SetItemText( row, ++step, text ); } text.Format( _T( "%d" ), data.mValue2 ); listCtrl.SetItemText( row, ++step, text ); } { int minRange; int maxRange; progressCtrl.GetRange( minRange, maxRange ); progressCtrl.SetPos( progressCtrl.GetPos() + m->mSize ); CString text; text.Format( _T( "%d/%d" ), progressCtrl.GetPos(), maxRange ); resultStatic.SetWindowText( text ); // 080523 LUJ, 버튼 활성화 체크가 정상적으로 되도록 수정함 if( progressCtrl.GetPos() == maxRange ) { findButton.EnableWindow( TRUE ); stopButton.EnableWindow( FALSE ); } } break; } case MP_RM_FARM_LOG_SIZE_ACK: { const MSG_DWORD* m = ( MSG_DWORD* )message; const DWORD size = m->dwData; CString text; text.Format( _T( "0/%d" ), size ); resultStatic.SetWindowText( text ); progressCtrl.SetRange32( 0, size ); progressCtrl.SetPos( 0 ); findButton.EnableWindow( FALSE ); stopButton.EnableWindow( TRUE ); listCtrl.DeleteAllItems(); break; } case MP_RM_FARM_LOG_SIZE_NACK: { CString textThereIsNoResult; textThereIsNoResult.LoadString( IDS_STRING1 ); MessageBox( 0, textThereIsNoResult, _T( "" ), MB_ICONERROR | MB_OK ); break; } case MP_RM_FARM_LOG_STOP_ACK: { findButton.EnableWindow( TRUE ); stopButton.EnableWindow( FALSE ); CString textSearchWasStopped; textSearchWasStopped.LoadString( IDS_STRING2 ); MessageBox( 0, textSearchWasStopped, _T( "" ), MB_ICONERROR | MB_OK ); break; } case MP_RM_FARM_LOG_NACK_BY_AUTH: { CString textYouHaveNoAuthority; textYouHaveNoAuthority.LoadString( IDS_STRING18 ); MessageBox( 0, textYouHaveNoAuthority, _T( "" ), MB_OK | MB_ICONERROR ); break; } default: { ASSERT( 0 ); break; } } }
int ShowProgress(LPCTSTR pName, float fPencent) { g_ProgressName.SetWindowText(pName); g_ProgressProgress.SetPos((int)(fPencent * 100)); return 0; }
void CComputeDlg::OnTimer(UINT nIDEvent) { CProgressCtrl* pBar = (CProgressCtrl*) GetDlgItem(IDC_PROGRESS1); pBar->SetPos(m_nCount * 100 / nMaxCount); }
void CSiegeLogCommand::Parse( const MSGROOT* message, CListCtrl& listCtrl, CProgressCtrl& progressCtrl, CStatic& resultStatic, CButton& findButton, CButton& stopButton ) const { switch( message->Protocol ) { case MP_RM_SIEGE_LOG_ACK: { // 080401 LUJ, 이전 로그에 대한 인덱스 세트를 만들어 중복되지 않도록 체크한다 std::set< DWORD > indexSet; { for( int row = 0; row < listCtrl.GetItemCount(); ++row ) { indexSet.insert( _ttoi( listCtrl.GetItemText( row, 0 ) ) ); } } // 081027 LUJ, 메모를 판단해서 적절한 글로 변경한다. 원래 state안의 숫자는 // [Map]Server\SiegeWareMgr.h에 선언된 enum 상수이나, 헤더를 참조 // 하면 컴파일에 문제가 있어 유연성이 없지만 분리했다 class { public: CString operator()( const CString& text ) const { if( text == _T( "state:0" ) ) { CString textWait; textWait.LoadString( IDS_STRING420 ); return textWait; } else if( text == _T( "state:1" ) ) { CString textStart; textStart.LoadString( IDS_STRING291 ); return textStart; } else if( text == _T( "state:2" ) ) { CString textReady; textReady.LoadString( AFX_IDS_IDLEMESSAGE ); CString textInstall; textInstall.LoadString( IDS_STRING418 ); CString textWaterseed; textWaterseed.LoadString( IDS_STRING417 ); } else if( text == _T( "state:3" ) ) { CString textEnd; textEnd.LoadString( IDS_STRING292 ); return textEnd; } return text; } } Translate; const MSG_RM_SIEGE_LOG* m = ( MSG_RM_SIEGE_LOG* )message; for( DWORD i = 0; i < m->mSize; ++i ) { const MSG_RM_SIEGE_LOG::Log& data = m->mLog[ i ]; const DWORD row = listCtrl.GetItemCount(); int step = 0; if( indexSet.end() != indexSet.find( data.mIndex ) ) { continue; } CString text; text.Format( _T( "%d" ), data.mIndex ); listCtrl.InsertItem( row, text, 0 ); listCtrl.SetItemText( row, ++step, CA2WEX< sizeof( data.mDate ) >( data.mDate ) ); listCtrl.SetItemText( row, ++step, mApplication.GetText( data.mType ) ); text.Format( _T( "%d" ), data.mGuildIndex ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), data.mPlayerIndex ); listCtrl.SetItemText( row, ++step, text ); listCtrl.SetItemText( row, ++step, Translate( CString( data.mMemo ) ) ); } { int minRange; int maxRange; progressCtrl.GetRange( minRange, maxRange ); progressCtrl.SetPos( progressCtrl.GetPos() + m->mSize ); CString text; text.Format( _T( "%d/%d" ), progressCtrl.GetPos(), maxRange ); resultStatic.SetWindowText( text ); // 080523 LUJ, 버튼 활성화 체크가 정상적으로 되도록 수정함 if( progressCtrl.GetPos() == maxRange ) { findButton.EnableWindow( TRUE ); stopButton.EnableWindow( FALSE ); } } break; } case MP_RM_SIEGE_LOG_SIZE_ACK: { const MSG_DWORD* m = ( MSG_DWORD* )message; const DWORD size = m->dwData; CString text; text.Format( _T( "0/%d" ), size ); resultStatic.SetWindowText( text ); progressCtrl.SetRange32( 0, size ); progressCtrl.SetPos( 0 ); findButton.EnableWindow( FALSE ); stopButton.EnableWindow( TRUE ); listCtrl.DeleteAllItems(); break; } case MP_RM_SIEGE_LOG_SIZE_NACK: { CString textThereIsNoResult; textThereIsNoResult.LoadString( IDS_STRING1 ); MessageBox( 0, textThereIsNoResult, _T( "" ), MB_ICONERROR | MB_OK ); break; } case MP_RM_SIEGE_LOG_STOP_ACK: { findButton.EnableWindow( TRUE ); stopButton.EnableWindow( FALSE ); CString textSearchWasStopped; textSearchWasStopped.LoadString( IDS_STRING2 ); MessageBox( 0, textSearchWasStopped, _T( "" ), MB_ICONERROR | MB_OK ); break; } case MP_RM_SIEGE_LOG_NACK_BY_AUTH: { CString textYouHaveNoAuthority; textYouHaveNoAuthority.LoadString( IDS_STRING18 ); MessageBox( 0, textYouHaveNoAuthority, _T( "" ), MB_OK | MB_ICONERROR ); break; } default: { ASSERT( 0 ); break; } } }
void CModel::Resequence(bool bReScanASEFiles /* = false */) { CWaitCursor wait; CRect Rect; CProgressCtrl *pProgress = NULL; if (bReScanASEFiles && ((CAssimilateApp*)AfxGetApp())->m_pMainWnd) { pProgress = new CProgressCtrl; bool bOK = !!pProgress->Create( WS_CHILD|WS_VISIBLE|PBS_SMOOTH, // DWORD dwStyle, CRect(100,100,200,200), // const RECT& rect, ((CAssimilateApp*)AfxGetApp())->m_pMainWnd, // CWnd* pParentWnd, 1 // UINT nID ); if (!bOK) { delete pProgress; pProgress = NULL; } } int iTotMasterSequences = GetTotMasterSequences(); if (pProgress) { pProgress->SetRange(0,iTotMasterSequences); } int iSequenceNumber=0; int curFrame = 0; CSequence* curSequence = m_sequences; while(curSequence != NULL) { if (pProgress) { pProgress->SetPos(iSequenceNumber++); wait.Restore(); } // mark current enums as valid or not... curSequence->SetValidEnum(((CAssimilateApp*)AfxGetApp())->ValidEnum(curSequence->GetEnum())); for (int _i=0; _i<MAX_ADDITIONAL_SEQUENCES; _i++) { CSequence *additionalSeq = curSequence->AdditionalSeqs[_i]; additionalSeq->SetValidEnum(((CAssimilateApp*)AfxGetApp())->ValidEnum(additionalSeq->GetEnum())); } if ( bReScanASEFiles ) { // new code, first of all check for changed framecounts (ie updated ASE file), and update sequence if nec... CString nameASE = ((CAssimilateApp*)AfxGetApp())->GetQuakeDir(); nameASE+= curSequence->GetPath(); if (!FileExists(nameASE)) { if (gbCarWash_DoingScan) { strCarWashErrors += va("Model file missing: \"%s\"\n",nameASE); } else { if ( gbReportMissingASEs ) { gbReportMissingASEs = GetYesNo(va("Model file missing: \"%s\"\n\nContinue recieving this message?",nameASE)); } } } else { int iStartFrame, iFrameCount, iFrameSpeed; iFrameCount = curSequence->GetFrameCount(); // default it in case we skip an XSI read iFrameSpeed = curSequence->GetFrameSpeed(); // default it in case we cache this file curSequence->ReadASEHeader( nameASE, iStartFrame, iFrameCount, iFrameSpeed, true); // true = can skip XSI read if ( iFrameCount != curSequence->GetFrameCount() ) { if (gbCarWash_DoingScan) { strCarWashErrors += va("file: \"%s\" has a framecount of %d, but .CAR file says %d\n",nameASE,iFrameCount,curSequence->GetFrameCount()); } else { // don't mention it if the current count is zero, it's probably a new anim we've just added... if ( curSequence->GetFrameCount() ) { if (giFixUpdatedASEFrameCounts == YES || giFixUpdatedASEFrameCounts == NO) { CYesNoYesAllNoAll query( va("Model file: \"%s\"",nameASE), "", va("... has a framecount of %d instead of %d as the QDT/CAR file says",iFrameCount, curSequence->GetFrameCount()), "", "", "Do you want me to fix this?" ); giFixUpdatedASEFrameCounts = query.DoModal(); } } // update the sequence?... if (giFixUpdatedASEFrameCounts == YES || giFixUpdatedASEFrameCounts == YES_ALL || !curSequence->GetFrameCount() // update: I think this should be here? ) { curSequence->SetFrameCount( iFrameCount ); } } } } // findmeste: this no longer seems to do anything under JK2, presumablt EF1-only? #if 0 // now try to do any auto-associate between the ASE filename base and the existing enums, // so if we find (eg) /...../...../CROUCH.ASE and we have BOTH_CROUCH then auto-set the enum to BOTH_CROUCH CString stringASEName = nameASE; Filename_BaseOnly(stringASEName); // now = (eg) "falldeath" or "injured" etc for (int i=0; ; i++) { LPCSTR p = ((CAssimilateApp*)AfxGetApp())->GetEnumEntry(i); if (!p) // EOS? break; CString stringEnum = p; // note, I could check stuff like "IsEnumSeperator(LPCSTR lpString)" on <p>, but you'd never // have one of those enums assigned to a sequence anyway. char *psEnumPosAfterUnderScore = strchr(stringEnum,'_'); if (psEnumPosAfterUnderScore++) // check it, and skip to next char { // does this enum match the ASE name? if ( !stricmp( psEnumPosAfterUnderScore, stringASEName ) ) { // ok, we've found a good candidate, so set it... (no need for query-prev code, but I wanted to) if ( strcmp( curSequence->GetEnum(), stringEnum)) { curSequence->SetEnum(stringEnum); } } } else { // this should never happen... if (gbCarWash_DoingScan) { strCarWashErrors += va("found an anim enum with no underscore: \"%s\"\n",stringEnum); } else { ASSERT(0); ErrorBox(va("Error! Somehow I found an anim enum with no underscore: \"%s\"",stringEnum)); } } } #endif } // More bollox for Gummelt... :-) // now do the other freaky trick (you'd better be grateful for all this Mike!!! <g>), which is: // If you find the substring DEATH in this (master) sequence's enum, then ensure that the first *additional* // sequence of it is set to be the corresponding DEAD enum, but using the last frame only (and non-looping) // // (... or something...) { // keep scope local for neatness if ( strstr (curSequence->GetEnum(), "DEATH") ) { // scan this sequence's additional sequences for a DEAD of the same basic type... CString stringEnumDEAD = curSequence->GetEnum(); ASSERT(!IsEnumSeperator(stringEnumDEAD)); stringEnumDEAD.Replace("DEATH","DEAD"); // 1st, is there even a corresponding DEAD enum in the global enum table that we can look for... CString stringEnum; bool bEnumFound = false; for (int iEnumEntry=0; !bEnumFound; iEnumEntry++) { LPCSTR p = ((CAssimilateApp*)AfxGetApp())->GetEnumEntry(iEnumEntry); if (!p) // EOS? break; stringEnum = p; // note, I could check stuff like "IsEnumSeperator(LPCSTR lpString)" on <p>, but you'd never // have one of those enums assigned to a sequence anyway. // does this enum match the one we've built? if ( !_stricmp( stringEnum, stringEnumDEAD ) ) { bEnumFound = true; } } if ( bEnumFound ) { // ok, there *is* one of these, so let's scan this sequence's additional sequences to see if we've // got it... CSequence *additionalSeq; // outside FOR scope for (int i=0; i<MAX_ADDITIONAL_SEQUENCES; i++) { additionalSeq = curSequence->AdditionalSeqs[i]; if (additionalSeq->AdditionalSequenceIsValid()) { if (!strcmp(additionalSeq->GetEnum(),stringEnum)) { break; // we've found one! } } } // if we didn't find one, NULL the ptr if (int i=MAX_ADDITIONAL_SEQUENCES) { additionalSeq = NULL; } // did we find one? (or did it have the wrong info in?) if ( additionalSeq == NULL // didn't find one || additionalSeq->GetFrameCount()!=1 || additionalSeq->GetLoopFrame() !=-1 || additionalSeq->GetStartFrame()!= curSequence->GetFrameCount()-1 || additionalSeq->GetFrameSpeed()!= curSequence->GetFrameSpeed() ) { // find a slot to add this new sequence to, or use the faulty one... if (additionalSeq == NULL) { for (int i=0; i<MAX_ADDITIONAL_SEQUENCES; i++) { additionalSeq = curSequence->AdditionalSeqs[i]; if (!additionalSeq->AdditionalSequenceIsValid()) { break; // found an unused slot } } } // so have we got a slot to work with? if ( additionalSeq == NULL ) { if (gbCarWash_DoingScan) { strCarWashErrors += va( "F**k!!!: I need an 'additional sequence' slot free in the entry: \"%s\" to generate a DEAD seq, but there isn't one spare. Edit this yourself later.\n",curSequence->GetPath()); } else { ErrorBox( va( "F**k!!!\n\nI need an 'additional sequence' slot free in the ASE:\n\n\"%s\"\n\n... to generate a DEAD seq, but there isn't one spare. Edit this yourself later.",curSequence->GetPath())); } } else { additionalSeq->SetStartFrame( curSequence->GetFrameCount()-1 ); additionalSeq->SetFrameCount( 1 ); additionalSeq->SetLoopFrame (-1 ); additionalSeq->SetFrameSpeed( curSequence->GetFrameSpeed() ); additionalSeq->SetEnum ( stringEnumDEAD ); } } } } } curSequence->SetTargetFrame(curFrame + curSequence->GetStartFrame()); // slightly more legal than just (curFrame) // update: now set any additional sequences within it... for (int i=0; i<MAX_ADDITIONAL_SEQUENCES; i++) { curSequence->AdditionalSeqs[i]->SetTargetFrame(curFrame + curSequence->AdditionalSeqs[i]->GetStartFrame()); } curFrame += curSequence->GetFrameCount(); curFrame += curSequence->GetGenLoopFrame()?1:0; // findme: is this right? I hate this system curSequence = curSequence->GetNext(); } m_totFrames = curFrame; ghAssimilateView->GetDocument()->SetModifiedFlag(); if (pProgress) { delete pProgress; pProgress = 0; } }
void CWavProgressDlg::OnTimer(UINT_PTR nIDEvent) { // Update progress status CString Text; DWORD Time = (GetTickCount() - m_dwStartTime) / 1000; CProgressCtrl *pProgressBar = static_cast<CProgressCtrl*>(GetDlgItem(IDC_PROGRESS_BAR)); CSoundGen *pSoundGen = theApp.GetSoundGenerator(); bool Rendering = pSoundGen->IsRendering(); int Frame, RenderedTime, FramesToRender, RowCount, Row; bool Done; pSoundGen->GetRenderStat(Frame, RenderedTime, Done, FramesToRender, Row, RowCount); if (!Rendering) Row = RowCount; // Force 100% CString str1, str2; int PercentDone; switch (m_iSongEndType) { case SONG_LOOP_LIMIT: if (Frame > FramesToRender) Frame = FramesToRender; PercentDone = (Row * 100) / RowCount; str1.Format(_T("%i / %i"), Row, FramesToRender); // // // str2.Format(_T("%i%%"), PercentDone, Row, RowCount); AfxFormatString2(Text, IDS_WAVE_PROGRESS_ROW_FORMAT, str1, str2); // // // break; case SONG_TIME_LIMIT: int TotalSec = m_iSongEndParam % 60; int TotalMin = m_iSongEndParam / 60; int CurrSec = RenderedTime % 60; int CurrMin = RenderedTime / 60; PercentDone = (RenderedTime * 100) / m_iSongEndParam; str1.Format(_T("%02i:%02i / %02i:%02i"), CurrMin, CurrSec, TotalMin, TotalSec); str2.Format(_T("%i%%"), PercentDone); AfxFormatString2(Text, IDS_WAVE_PROGRESS_TIME_FORMAT, str1, str2); break; } SetDlgItemText(IDC_PROGRESS_LBL, Text); CString str; str.Format(_T("%02i:%02i"), (Time / 60), (Time % 60)); AfxFormatString1(Text, IDS_WAVE_PROGRESS_ELAPSED_FORMAT, str); SetDlgItemText(IDC_TIME, Text); pProgressBar->SetPos(PercentDone); if (!Rendering) { SetDlgItemText(IDC_CANCEL, CString(MAKEINTRESOURCE(IDS_WAVE_EXPORT_DONE))); CString title; GetWindowText(title); title.Append(_T(" ")); title.Append(CString(MAKEINTRESOURCE(IDS_WAVE_EXPORT_FINISHED))); SetWindowText(title); pProgressBar->SetPos(100); KillTimer(0); } CDialog::OnTimer(nIDEvent); }
void CWaterCheckDlg::Watermark_Thread() { CProgressCtrl *pProgCtrl = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS_CHECK); pProgCtrl->SetRange(0, 1000); pProgCtrl->SetPos(0); PLAY_SetStreamOpenMode( WATERMARK_PORT, STREAME_FILE); PLAY_OpenStream(WATERMARK_PORT, NULL, 0, 1024 * 100); PLAY_SetDecCallBack(WATERMARK_PORT, MediaDecCBFun); PLAY_SetDecCBStream(WATERMARK_PORT, 3); if (!PLAY_Play(WATERMARK_PORT, NULL)) { PLAY_CloseStream(WATERMARK_PORT); } PLAY_SetWaterMarkCallBackEx(WATERMARK_PORT, CBWaterMarkFuncEx, (long)this); CFile SourceFile; if ( !SourceFile.Open(m_csFilePath, CFile::modeRead | CFile::shareDenyNone) ) { PLAY_Stop(WATERMARK_PORT); PLAY_CloseStream(WATERMARK_PORT); } DWORD dwFileLen = SourceFile.GetLength(); const int BUFLEN = 8 * 1024; BYTE InfoBuf[BUFLEN]; DWORD nRead; DWORD dwCurPos = 0; try { while (m_bCheckEnable) { memset(InfoBuf, 0, sizeof(InfoBuf)); nRead = SourceFile.Read(InfoBuf, BUFLEN); if (nRead <= 0) { break; } dwCurPos += nRead; while (m_bCheckEnable && !PLAY_InputData( WATERMARK_PORT, InfoBuf, nRead))//阻塞为false { Sleep(5); } double fpress = (double)dwCurPos/(double)dwFileLen; int iProgressPos = (int)(fpress*1000.0); if (m_bCheckEnable) pProgCtrl->SetPos(iProgressPos); } } catch (CException* e) { PLAY_Stop(WATERMARK_PORT); PLAY_CloseStream(WATERMARK_PORT); SourceFile.Close(); e->Delete(); } while (m_bCheckEnable && !(PLAY_GetSourceBufferRemain(WATERMARK_PORT) == 0)) { //解码结束, number=0时,解码出来的数据都已显示或回调完全 //number < num时,解码基本完成 while (m_bCheckEnable && PLAY_GetSourceBufferRemain(WATERMARK_PORT) > 0) { if (PLAY_GetBufferValue(WATERMARK_PORT, BUF_VIDEO_RENDER) < 1) { //解码结束的相关操作 Sleep(5); break; } else { Sleep(10); } } } pProgCtrl->SetPos(1000); PLAY_Stop(WATERMARK_PORT); PLAY_CloseStream(WATERMARK_PORT); SourceFile.Close(); if (m_bCheckEnable) { MessageBox("Watermark Check Complete!!"); m_bCheckEnable = FALSE; GetDlgItem(IDC_BUTTON_CHECK)->SetWindowText("check"); } pProgCtrl->SetPos(0); }
void CTransferDlg::SetTotalProgress(int nPercent) { CProgressCtrl* pProgress = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS_TOTAL); pProgress->SetPos(nPercent); }
void CDBFExplorerDoc::ExportToText(LPCTSTR lpszFileName) { USES_CONVERSION; try { CFile file; // Create "progress bar" CProgressCtrl wndProgress; GetActiveFrame()->ShowProgressBar(&wndProgress, _T("Exporting records, press Esc to cancel...")); // Initialize progress control range and step size wndProgress.SetRange(0, 100); int nCount = m_dBaseFile->GetRecordCount(); if (file.Open(lpszFileName, CFile::modeWrite | CFile::shareExclusive | CFile::modeCreate, NULL)) { // show all records for(int rc=m_dBaseFile->GetFirstRecord(); rc==DBASE_SUCCESS; rc=m_dBaseFile->GetNextRecord()) { // Test for "Esc" key if( ::GetAsyncKeyState(VK_ESCAPE) < 0) { break; } int nItem = m_dBaseFile->GetPosition(); // do not show deleted records if (m_dBaseFile->IsRecordDeleted() && !GetActiveFrame()->m_bShowDeletedRecords) continue; for (size_t i = 0; i < m_dBaseFile->GetFieldCount(); i++) { CString szBuff; DBF_FIELD_INFO info; m_dBaseFile->GetFieldInfo(i, &info); if (info.type == DBF_DATA_TYPE_MEMO) { szBuff = _T("MEMO"); } else { m_dBaseFile->Read(i, &szBuff); } if (i != 1) file.Write(",", 1); file.Write(T2CA(szBuff), szBuff.GetLength()); } file.Write("\r\n", 2); // Update progress control int nPos = (nItem*100)/nCount; wndProgress.SetPos(nPos); } } } catch(CFileException *e) { e->Delete(); MessageBox(GetFocus(), _T("Failed to export database!"), _T("Export Database"), MB_OK | MB_ICONSTOP); } // Ensures that idle message is displayed again GetActiveFrame()->PostMessage(WM_SETMESSAGESTRING, (WPARAM) AFX_IDS_IDLEMESSAGE, 0L); }
void CProgressDlg::ParserCmdOutput(CRichEditCtrl &log,CProgressCtrl &progressctrl,HWND m_hWnd,CComPtr<ITaskbarList3> m_pTaskbarList,CStringA &oneline, char ch, CWnd *CurrentWork) { //TRACE(_T("%c"),ch); if( ch == ('\r') || ch == ('\n')) { CString str; // TRACE(_T("End Char %s \r\n"),ch==_T('\r')?_T("lf"):_T("")); // TRACE(_T("End Char %s \r\n"),ch==_T('\n')?_T("cr"):_T("")); if(ClearESC(oneline)) { ch = ('\r'); } int lines = log.GetLineCount(); g_Git.StringAppend(&str,(BYTE*)oneline.GetBuffer(),CP_ACP); str.Trim(); // TRACE(_T("%s"), str); if(ch == ('\r')) { int start=log.LineIndex(lines-1); log.SetSel(start, log.GetTextLength()); log.ReplaceSel(str); } else { int length = log.GetWindowTextLength(); log.SetSel(length, length); if (length > 0) log.ReplaceSel(_T("\r\n") + str); else log.ReplaceSel(str); } if (lines > 500) //limited log length { int end=log.LineIndex(1); log.SetSel(0,end); log.ReplaceSel(_T("")); } log.LineScroll(log.GetLineCount() - log.GetFirstVisibleLine() - 4); int s1=oneline.ReverseFind(_T(':')); int s2=oneline.Find(_T('%')); if (s1 > 0 && s2 > 0) { if(CurrentWork) CurrentWork->SetWindowTextW(str.Left(s1)); int pos=FindPercentage(str); TRACE(_T("Pos %d\r\n"),pos); if(pos>0) { progressctrl.SetPos(pos); if (m_pTaskbarList) { m_pTaskbarList->SetProgressState(m_hWnd, TBPF_NORMAL); m_pTaskbarList->SetProgressValue(m_hWnd, pos, 100); } } } oneline=""; } else { oneline+=ch; } }
void CItemOptionLogCommand::Parse( const MSGROOT* message, CListCtrl& listCtrl, CProgressCtrl& progressCtrl, CStatic& resultStatic, CButton& findButton, CButton& stopButton ) const { switch( message->Protocol ) { case MP_RM_ITEM_OPTION_LOG_GET_ACK: { // 080401 LUJ, 이전 로그에 대한 인덱스 세트를 만들어 중복되지 않도록 체크한다 std::set< DWORD > indexSet; { for( int row = 0; row < listCtrl.GetItemCount(); ++row ) { indexSet.insert( _ttoi( listCtrl.GetItemText( row, 0 ) ) ); } } const MSG_RM_ITEM_OPTION_LOG* m = ( MSG_RM_ITEM_OPTION_LOG* )message; for( DWORD i = 0; i < m->mSize; ++i ) { const MSG_RM_ITEM_OPTION_LOG::Log& data = m->mLog[ i ]; const DWORD row = listCtrl.GetItemCount(); int step = -1; if( indexSet.end() != indexSet.find( data.mLogIndex ) ) { continue; } CString text; text.Format( _T( "%d" ), data.mLogIndex ); listCtrl.InsertItem( row, text, ++step ); listCtrl.SetItemText( row, ++step, CA2WEX< sizeof( data.mDate ) >( data.mDate ) ); listCtrl.SetItemText( row, ++step, mApplication.GetText( data.mType ) ); text.Format( _T( "%d" ), data.mItemDbIndex ); listCtrl.SetItemText( row, ++step, text ); { const ITEM_OPTION::Reinforce& reinforce = data.mOption.mReinforce; text.Format( _T( "%d" ), reinforce.mStrength ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mDexterity ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mVitality ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mIntelligence ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mWisdom ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mLife ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mMana ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mLifeRecovery ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mManaRecovery ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mPhysicAttack ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mPhysicDefence ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mMagicAttack ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), reinforce.mMagicDefence ); listCtrl.SetItemText( row, ++step, text ); // 080428 LUJ, 크리티컬 레이트가 이동 속도로 잘못 저장되고 있음 text.Format( _T( "%d" ), reinforce.mMoveSpeed ); listCtrl.SetItemText( row, ++step, text ); // 080428 LUJ, 크리티컬 데미지가 회피로 잘못 저장되고 있음 text.Format( _T( "%d" ), reinforce.mEvade ); listCtrl.SetItemText( row, ++step, text ); // 080428 LUJ, 이동 속도가 명중으로 잘못 저장되고 있음. text.Format( _T( "%d" ), reinforce.mAccuracy ); listCtrl.SetItemText( row, ++step, text ); // 080428 LUJ, 회피가 크리티컬 레이트로 잘못 저장되고 있음 text.Format( _T( "%d" ), reinforce.mCriticalRate ); listCtrl.SetItemText( row, ++step, text ); // 080428 LUJ, 명중이 크리티컬 데미지로 잘못 저장되고 있음 text.Format( _T( "%d" ), reinforce.mCriticalDamage ); listCtrl.SetItemText( row, ++step, text ); } { const ITEM_OPTION::Mix& mix = data.mOption.mMix; text.Format( _T( "%d" ), mix.mStrength ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), mix.mIntelligence ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), mix.mDexterity ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), mix.mWisdom ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), mix.mVitality ); listCtrl.SetItemText( row, ++step, text ); } { const ITEM_OPTION::Enchant& enchant = data.mOption.mEnchant; text.Format( _T( "%d" ), enchant.mIndex ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), enchant.mLevel ); listCtrl.SetItemText( row, ++step, text ); } listCtrl.SetItemText( row, ++step, CA2WEX< sizeof( data.mMemo ) >( data.mMemo ) ); } { int minRange; int maxRange; progressCtrl.GetRange( minRange, maxRange ); progressCtrl.SetPos( progressCtrl.GetPos() + int( m->mSize ) ); CString text; text.Format( _T( "%d/%d" ), progressCtrl.GetPos(), maxRange ); resultStatic.SetWindowText( text ); // 080523 LUJ, 버튼 활성화 체크가 정상적으로 되도록 수정함 if( progressCtrl.GetPos() == maxRange ) { findButton.EnableWindow( TRUE ); stopButton.EnableWindow( FALSE ); } } break; } case MP_RM_ITEM_OPTION_LOG_SIZE_ACK: { const MSG_DWORD* m = ( MSG_DWORD* )message; const DWORD size = m->dwData; CString text; text.Format( _T( "0/%d" ), size ); resultStatic.SetWindowText( text ); progressCtrl.SetRange32( 0, size ); progressCtrl.SetPos( 0 ); findButton.EnableWindow( FALSE ); stopButton.EnableWindow( TRUE ); listCtrl.DeleteAllItems(); break; } case MP_RM_ITEM_OPTION_LOG_SIZE_NACK: { CString textThereIsNoResult; textThereIsNoResult.LoadString( IDS_STRING1 ); MessageBox( 0, textThereIsNoResult, _T( "" ), MB_ICONERROR | MB_OK ); break; } case MP_RM_ITEM_OPTION_LOG_STOP_ACK: { findButton.EnableWindow( TRUE ); stopButton.EnableWindow( FALSE ); CString textSearchWasStopped; textSearchWasStopped.LoadString( IDS_STRING2 ); MessageBox( 0, textSearchWasStopped, _T( "" ), MB_ICONERROR | MB_OK ); break; } case MP_RM_ITEM_OPTION_LOG_NACK_BY_AUTH: { CString textYouHaveNoAuthority; textYouHaveNoAuthority.LoadString( IDS_STRING18 ); MessageBox( 0, textYouHaveNoAuthority, _T( "" ), MB_OK | MB_ICONERROR ); break; } default: { ASSERT( 0 ); break; } } }
void CTransferDlg::SetFileProgress(int nPercent) { CProgressCtrl* pProgress = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS_FILE); pProgress->SetPos(nPercent); }
void CExperienceLogCommand::Parse( const MSGROOT* message, CListCtrl& listCtrl, CProgressCtrl& progressCtrl, CStatic& resultStatic, CButton& findButton, CButton& stopButton ) const { switch( message->Protocol ) { case MP_RM_EXP_LOG_GET_SIZE_ACK: { const MSG_DWORD* m = ( MSG_DWORD* )message; const DWORD size = m->dwData; CString text; text.Format( _T( "0/%d" ), size ); resultStatic.SetWindowText( text ); progressCtrl.SetRange32( 0, size ); progressCtrl.SetPos( 0 ); findButton.EnableWindow( FALSE ); stopButton.EnableWindow( TRUE ); listCtrl.DeleteAllItems(); break; } case MP_RM_EXP_LOG_GET_SIZE_NACK: { CString textThereIsNoResult; textThereIsNoResult.LoadString( IDS_STRING1 ); MessageBox( 0, textThereIsNoResult, _T( "" ), MB_ICONERROR | MB_OK ); break; } case MP_RM_EXP_LOG_GET_ACK: { const MSG_RM_EXP_LOG* m = ( MSG_RM_EXP_LOG* )message; // 080401 LUJ, 이전 로그에 대한 인덱스 세트를 만들어 중복되지 않도록 체크한다 std::set< DWORD > indexSet; { for( int row = 0; row < listCtrl.GetItemCount(); ++row ) { indexSet.insert( _ttoi( listCtrl.GetItemText( row, 0 ) ) ); } } for( DWORD i = 0; i < m->mSize; ++i ) { const MSG_RM_EXP_LOG::Log& data = m->mLog[ i ]; const DWORD row = listCtrl.GetItemCount(); int step = 0; if( indexSet.end() != indexSet.find( data.mLogIndex ) ) { continue; } CString text; text.Format( _T( "%d" ), data.mLogIndex ); listCtrl.InsertItem( row, text, 0 ); listCtrl.SetItemText( row, ++step, CA2WEX< sizeof( data.mDate ) >( data.mDate ) ); // 080416 LUJ, 로그 종류를 문자로 표시하도록 함 listCtrl.SetItemText( row, ++step, mApplication.GetText( data.mType ) ); text.Format( _T( "%d" ), data.mGrade ); listCtrl.SetItemText( row, ++step, text ); text.Format( _T( "%d" ), data.mVariation ); listCtrl.SetItemText( row, ++step, text ); // 080716 LUJ, 킬러 종류를 번호로 표시한다 text.Format( _T( "%d" ), data.mKillerKind ); listCtrl.SetItemText( row, ++step, text ); listCtrl.SetItemText( row, ++step, mApplication.GetMonsterName( data.mKillerKind ) ); text.Format( _T( "%d" ), data.mKillerIndex ); listCtrl.SetItemText( row, ++step, text ); // 080716 LUJ, 경험치 형이 커져서 실수형으로 변경 text.Format( _T( "%0.0f" ), data.mExperience ); listCtrl.SetItemText( row, ++step, text ); // 080716 LUJ, 로그 상태에 따라 다른 형식으로 표시 switch( data.mType ) { case eExpLog_ProtectExp: { CString textProtect; textProtect.LoadString( IDS_STRING402 ); text.Format( _T( "%s: %d" ), textProtect, data.mCount ); listCtrl.SetItemText( row, ++step, text ); break; } } } { int minRange; int maxRange; progressCtrl.GetRange( minRange, maxRange ); progressCtrl.SetPos( progressCtrl.GetPos() + int( m->mSize ) ); CString text; text.Format( _T( "%d/%d" ), progressCtrl.GetPos(), maxRange ); resultStatic.SetWindowText( text ); // 080523 LUJ, 버튼 활성화 체크가 정상적으로 되도록 수정함 if( progressCtrl.GetPos() == maxRange ) { findButton.EnableWindow( TRUE ); stopButton.EnableWindow( FALSE ); } } break; } case MP_RM_EXP_LOG_GET_STOP_ACK: { findButton.EnableWindow( TRUE ); stopButton.EnableWindow( FALSE ); CString textSearchWasStopped; textSearchWasStopped.LoadString( IDS_STRING2 ); MessageBox( 0, textSearchWasStopped, _T( "" ), MB_ICONERROR | MB_OK ); break; } case MP_RM_EXP_LOG_GET_STOP_NACK: { ASSERT( 0 ); break; } default: { break; } } }