[译]XTimer-带有源代码的计时器和秒表实用程序
By robot-v1.0
本文链接 https://www.kyfws.com/applications/xtimer-timer-and-stopwatch-utility-with-source-cod-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 6 分钟阅读 - 2558 个词 阅读量 0[译]XTimer-带有源代码的计时器和秒表实用程序
原文地址:https://www.codeproject.com/Articles/4233/XTimer-Timer-and-Stopwatch-Utility-with-Source-Cod
原文作者:Hans Dietrich
译文由本站 robot-v1.0 翻译
前言
XTimer provides countdown timer and stopwatch features in a compact MFC dialog app.
XTimer在紧凑的MFC对话框应用程序中提供了倒数计时器和秒表功能.
介绍(Introduction)
XTimer(XTimer)是用于测量持续时间的有用工具-例如,如果您要测量程序运行所需的时间.(is a useful tool for measuring time durations - for example, if you want to measure how long it takes for a program to run.)XTimer(XTimer)提供以下功能:(offers these features:)
- 倒计时器(Countdown timer)-从某些HH:MM:SS值倒计数(如微波炉定时器),直到零.(- counts down (like a microwave oven timer) from some HH:MM:SS value to zero.)
- 跑表(Stopwatch)-连续计数直到停止.(- continuously counts up until stopped.)
- 播放wav文件(Play a wav file)-倒数计时器到期后,(- when the countdown timer expires,)XTimer(XTimer)可以选择播放wav文件.(will optionally play a wav file.)
- 紧凑的尺寸(Compact size)-占用桌面空间很小.(- takes very little space on the desktop.)
- 播放一次/播放直到停止(Play once/Play until stopped)-仅播放一次声音,或连续播放(每30秒)直到声音(- play the sound only once, or play it continuously (every 30 seconds) until the)停止(Stop)按钮被点击.(button is clicked.)
XTimer用户界面(XTimer User Interface)
主视窗(Main Window)
主窗口上有三个按钮:(There are three buttons on the main window:)开始(Start),它将启动计时器/秒表,然后更改为(, which starts the timer/stopwatch and then changes to)停止(Stop);(;)重启(Reset),它将计时器恢复为零位置;和(, which sets the timer back to the zero position; and)更多(More),该菜单显示上下文菜单(右键单击窗口也显示上下文菜单).(, which displays the context menu (the context menu is also displayed by right-clicking on the window).)
上下文菜单(Context Menu)
上下文菜单允许您选择(The context menu allows you to choose the)XTimer(XTimer)模式-(mode -)跑表(stopwatch)要么(or)倒数(countdown)计时器.更改模式时,(timer. When you change mode, the)XTimer(XTimer)字幕更改以反映您设置的模式.您还可以访问(caption changes to reflect the mode you have set. You can also access the)计时器选项对话框(Timer Options Dialog).(.)
的(The)快速计时器子菜单(Quick Timer sub-menu)可让您为倒数计时器选择时间,并且还会自动启动计时器.(allows you to choose a time for the countdown timer, and will also automatically start the timer.)
计时器选项对话框(Timer Options Dialog)
的(The)计时器选项对话框(Timer Options Dialog)允许您设置倒数时间和计时器到期时要播放的wav文件.如果(allows you to set the countdown time and the wav file to be played when the timer expires. If the)播放倒数计时器声音(Play Countdown Timer Sound)被选中但未选择wav文件,(is checked but no wav file is selected,)XTimer(XTimer)将播放其默认声音.要完全禁用所有声音,请取消选中(will play its default sound. To completely disable all sounds, uncheck)播放倒数计时器声音(Play Countdown Timer Sound).(.)
您可以选择只播放一次声音,或连续播放(每30秒)直到声音(You can choose to play the sound only once, or play it continuously (every 30 seconds) until the)停止(Stop)按钮被点击.如果(button is clicked. If the)播放直到停止(Play until stopped)选项被选中,标题将变为(option is selected, the caption will change to)XTimer [TIMER +](XTimer [TIMER+]).(.)
使用XTimer(Using XTimer)
**XTimer.exe(XTimer.exe)**是自包含的,不需要其他文件(标准MFC和系统DLL除外).选择模式(对于计时器,倒数时间和声音选项)后,请单击(is self-contained and needs no other files (besides the standard MFC and system DLLs). After selecting the mode (and for the timer, the countdown time and sound options), click)开始(Start).秒表/计时器将开始运行,并且(. The stopwatch/timer will begin running, and the)开始(Start)按钮将变为(button will change to)停止(Stop).如果您点击(. If you click on the)停止(Stop)按钮,它将更改回(button, it will change back to)开始(Start)并且计时器将停止运行.显示屏将保留最后显示的值,并且如果您单击(and the timer will stop running. The display will hold the last value displayed and will continue from the last value if you click on the)开始(Start)按钮.(button.)
XTimer(XTimer)将其设置保存到注册表中(saves its settings to the registry in)HKEY_CURRENT_USER \ Software \ CodeProject \ XTimer(HKEY_CURRENT_USER\Software\CodeProject\XTimer).(.)
致谢(Acknowledgments)
- CButtonST v3.9(MFC平面按钮)(CButtonST v3.9 (MFC Flat buttons)) 由Davide Calabro.(by Davide Calabro.)
- 高分辨率日期和时间等级(High resolution date and time class) 由HåkanTrygg撰写.(by Håkan Trygg.)
- LED样式显示控件和条形控件(An LED Style display control and bar control) 由Jason Hattingh撰写.(by Jason Hattingh.)
修订记录(Revision History)
版本1.3-2007年8月11日(Version 1.3 - 2007 August 11)
- 将程序选项保存在注册表中(Save program options in registry)
- 左键双击时间显示打开选项对话框(Left double-click on time display opens options dialog)
- 添加了快速计时器子菜单(Added Quick Timer sub-menu)
- 添加了VS2005项目(Added VS2005 project)
版本1.2-2003年6月16日(Version 1.2 - 2003 June 16)
- 修复了Pit M报告的显示错误.(Fixed display bug reported by Pit M.)
版本1.1-2003年6月14日(Version 1.1 - 2003 June 14)
- 添加了"播放一次,播放直到停止"选项(Added “Play once, Play until stopped” option)
版本1.0-2003年6月1日(Version 1.0 - 2003 June 1)
- 首次公开发行(Initial public release)
用法(Usage)
该软件已发布到公共领域.您可以随意使用它,但您可能不会出售此源代码.如果您对其进行修改或扩展,请考虑在此处发布新代码,以供所有人共享.该软件按"原样"提供,没有任何明示或暗示的保证.对于此软件可能引起的任何损坏或业务损失,我不承担任何责任.(This software is released into the public domain. You are free to use it in any way you like, except that you may not sell this source code. If you modify it or extend it, please to consider posting new code here for everyone to share. This software is provided “as is” with no expressed or implied warranty. I accept no liability for any damage or loss of business that this software may cause.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC6 WinXP Windows Win2K MFC Visual-Studio Dev 新闻 翻译