本文整理汇总了C++中TimeSpan::GetTotalSeconds方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeSpan::GetTotalSeconds方法的具体用法?C++ TimeSpan::GetTotalSeconds怎么用?C++ TimeSpan::GetTotalSeconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSpan
的用法示例。
在下文中一共展示了TimeSpan::GetTotalSeconds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTimer
LRESULT CISOProgressDialog::OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
extern bool AutorunErrorHandler(ActionStatus st);
BackgroundDriveReader::ProgressRecord progress = m_pReader->GetProgress();
unsigned progressVal = (unsigned)((progress.Done * kProgressRangeMax) / progress.Total);
if (progress.TotalBad)
{
if (m_pTaskbar)
m_pTaskbar->SetProgressState(m_hWnd, TBPF_INDETERMINATE);
m_ProgressBar.SetPos((int)((progress.ProcessedBad * kProgressRangeMax) / progress.TotalBad));
SetDlgItemText(IDC_PROGRESSLINE, String::sFormat(_TR(IDS_BADSECTORPROGRESSFMT, "Re-reading bad sectors (%d/%d)"), (int)progress.ProcessedBad, (int)progress.TotalBad).c_str());
}
else
{
if (m_pTaskbar)
m_pTaskbar->SetProgressValue(m_hWnd, progress.Done, progress.Total);
m_ProgressBar.SetPos(progressVal);
unsigned badSectorCount = m_pReader->GetTotalBadSectorCount();
if (!badSectorCount)
{
bool remainingTimeAccurate = false;
TimeSpan remainingTime = m_pReader->GetEstimatedRemainingTime(&remainingTimeAccurate);
String label = String::sFormat(_TR(IDS_SPEEDSTATFMT, "Average read speed: %s/s"), RateCalculator::FormatByteCount(progress.BytesPerSecond).c_str());
if (remainingTimeAccurate && (remainingTime.GetTotalSeconds() > 3))
label += String::sFormat(_TR(IDS_REMAININGTIMESUFFIX, ", remaining time: %02d:%02d"), remainingTime.GetTotalMinutes(), remainingTime.GetSeconds());
SetDlgItemText(IDC_PROGRESSLINE, label.c_str());
}
else
SetDlgItemText(IDC_PROGRESSLINE, String::sFormat(_TR(IDS_BADSECTFMT, "Average read speed: %s/s, %d bad sector(s) found"), RateCalculator::FormatByteCount(progress.BytesPerSecond).c_str(), badSectorCount).c_str());
}
if (m_pReader->QueryStatus().GetErrorCode() != Pending)
{
KillTimer(0);
::EnableWindow(GetDlgItem(IDC_PAUSE), FALSE);
ActionStatus st = m_pReader->QueryStatus();
if (st.Successful())
{
FunctionThread ejectThread(&EjectDriveProc, (PVOID)m_pReader->GetSourcePath());
if (SendDlgItemMessage(IDC_EJECTDISC, BM_GETCHECK) == BST_CHECKED)
ejectThread.Start();
if (SendDlgItemMessage(IDC_OPENFOLDER, BM_GETCHECK) == BST_CHECKED)
Win32::Process(Path::GetDirectoryName(ConstString(m_pReader->GetImagePath())).c_str(), _T("open"));
if (SendDlgItemMessage(IDC_MOUNTISO, BM_GETCHECK) == BST_CHECKED)
{
wchar_t wszKernelPath[512];
if (!VirtualCDClient::Win32FileNameToKernelFileName(m_pReader->GetImagePath(), wszKernelPath, __countof(wszKernelPath)))
MessageBox(_TR(IDS_BADIMGFN, "Invalid image file name!"), NULL, MB_ICONERROR);
else
{
TCHAR tsz[3] = {0,};
if (m_cbLetters.GetLBTextLen(m_cbLetters.GetCurSel()) < _countof(tsz))
m_cbLetters.GetLBText(m_cbLetters.GetCurSel(), tsz);
VirtualCDClient().ConnectDisk(wszKernelPath, (char)(tsz[0]), 0, m_RegParams.DisableAutorun, false, AutorunErrorHandler);
}
}
ejectThread.Join();
if (SendDlgItemMessage(IDC_CLOSEWINDOW, BM_GETCHECK) == BST_CHECKED)
{
EndDialog(IDOK);
SaveParams();
}
else
{
SetDlgItemText(IDCANCEL, _TR(IDS_CLOSE, "Close"));
m_ProgressBar.SetPos(kProgressRangeMax);
::SetFocus(GetDlgItem(IDCANCEL));
MessageBox(_TR(IDS_ISOCREATED, "The ISO image has been created successfully"), _TR(IDS_INFORMATION, "Information"), MB_ICONINFORMATION);
}
}
else
{
if (st.GetErrorCode() != OperationAborted)
MessageBox(st.GetMostInformativeText().c_str(), NULL, MB_ICONERROR);
DeleteFile(m_pReader->GetImagePath());
EndDialog(IDNO);
}
}
return 0;
}
示例2: PerformProcessActions
void CMainDlg::PerformProcessActions(PatchedProcess &proc, TimeSpan &runTime, bool *pPatchingStarted)
{
if ((proc.State == PatchProcessTerminated) || (proc.State == Unpatched))
CleanupProcessEntry(proc);
else
{
if (proc.hLogPipe == INVALID_HANDLE_VALUE)
proc.hLogPipe = CreateLogPipe(proc.PID);
}
if (proc.State == PatchPending)
{
if (runTime.GetTotalSeconds() > m_Params.PatchDelay)
{
bool started = InitiatePatching(proc);
if (pPatchingStarted)
*pPatchingStarted = started;
}
}
if (proc.State == PatchInProgress)
{
if (WaitForSingleObject(proc.hRemoteThread, 0) == WAIT_OBJECT_0)
{
DWORD dwCode = 0;
GetExitCodeThread(proc.hRemoteThread, &dwCode);
if (dwCode)
proc.State = PatchInProgress2;
else
proc.State = PatchFailed;
CloseHandle(proc.hRemoteThread);
proc.hRemoteThread = INVALID_HANDLE_VALUE;
}
}
if ((proc.State == PatchInProgress2) || (proc.State == PatchSuccessful))
{
if (proc.pStatus)
{
switch (proc.pStatus->PatchErrorPlus1 - 1)
{
case ERROR_SUCCESS:
proc.State = PatchSuccessful;
break;
case -1:
proc.State = PatchInProgress2;
break;
default:
proc.State = PatchFailed;
}
}
if (proc.pStatus->ProtocolMismatchStatus)
{
proc.State = ProtocolMismatch;
WORD expected = HIWORD(proc.pStatus->ProtocolMismatchStatus), found = LOWORD(proc.pStatus->ProtocolMismatchStatus);
proc.pStatus->ProtocolMismatchStatus = 0;
TCHAR tsz[256];
_sntprintf(tsz, __countof(tsz), _T("Warning! KDBAZIS.DLL version %x.%02x was loaded by virtual machine, while version %x.%02x was expected. Debugging functions disabled!"),
HIBYTE(found), LOBYTE(found), HIBYTE(expected), LOBYTE(expected));
MessageBox(tsz, _T("Invalid KDBAZIS.DLL version"), MB_ICONWARNING);
}
}
if (proc.State == UnpatchInProgress)
{
if (WaitForSingleObject(proc.hRemoteThread, 0) == WAIT_OBJECT_0)
{
CloseHandle(proc.hRemoteThread);
proc.hRemoteThread = INVALID_HANDLE_VALUE;
proc.State = Unpatched;
UpdateLog(proc);
CleanupProcessEntry(proc);
}
}
UpdateLog(proc);
}