void VDPositionControlW32::UpdateString(VDPosition pos) { wchar_t buf[512]; if (pos < 0) pos = mPosition; bool success = false; if (mpCB) success = mpCB->GetFrameString(buf, sizeof buf / sizeof buf[0], pos); if (!success) { if (mFrameRate.getLo()) { int ms, sec, min; long ticks = (long)mFrameRate.scale64ir(pos * 1000); ms = ticks %1000; ticks /= 1000; sec = ticks % 60; ticks /= 60; min = ticks % 60; ticks /= 60; success = (unsigned)swprintf(buf, sizeof buf / sizeof buf[0], L" Frame %I64d (%d:%02d:%02d.%03d)", (sint64)pos, ticks, min, sec, ms) < sizeof buf / sizeof buf[0]; } else success = (unsigned)swprintf(buf, sizeof buf / sizeof buf[0], L" Frame %I64d", (sint64)pos) < sizeof buf / sizeof buf[0]; } if (success) { HWND hwndFrame = GetDlgItem(mhwnd, IDC_FRAME); VDSetWindowTextW32(hwndFrame, buf); } }
void VDUIJobControlDialog::OnJobQueueStatusChanged(VDJobQueueStatus status) { VDStringW title(mStandardCaption); if (status == kVDJQS_Running) title.append_sprintf(L" (%d remaining)", g_VDJobQueue.GetPendingJobCount()); if (g_VDJobQueue.IsAutoUpdateEnabled()) title.append_sprintf(L" [%s] (%hs:%d)", g_VDJobQueue.GetJobFilePath(), g_VDJobQueue.GetRunnerName(), (uint32)g_VDJobQueue.GetRunnerId()); switch(status) { case kVDJQS_Idle: EnableControl(IDC_START, true); SetControlText(IDC_START, L"Start"); EnableControl(IDC_ABORT, false); EnableControl(IDC_RELOAD, true); break; case kVDJQS_Running: SetControlText(IDC_START, L"Stop"); EnableControl(IDC_START, true); EnableControl(IDC_ABORT, true); EnableControl(IDC_RELOAD, false); break; case kVDJQS_Blocked: SetControlText(IDC_START, L"Start"); EnableControl(IDC_START, false); EnableControl(IDC_ABORT, false); EnableControl(IDC_RELOAD, false); break; } VDSetWindowTextW32(mhdlg, title.c_str()); }
void VDSetWindowTextFW32(HWND hwnd, const wchar_t *format, ...) { va_list val; va_start(val, format); { wchar_t buf[512]; int r = vswprintf(buf, 512, format, val); if ((unsigned)r < 512) { VDSetWindowTextW32(hwnd, buf); va_end(val); return; } } VDStringW s; s.append_vsprintf(format, val); VDSetWindowTextW32(hwnd, s.c_str()); va_end(val); }