[译]电池X
By robot-v1.0
本文链接 https://www.kyfws.com/applications/batteryx-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 6 分钟阅读 - 2904 个词 阅读量 0[译]电池X
原文地址:https://www.codeproject.com/Articles/11135/BatteryX
原文作者:Nautilus Master
译文由本站 robot-v1.0 翻译
前言
BatteryX shows you the current powerstatus of your Notebook.
BatteryX向您显示笔记本计算机的当前电源状态.
- 下载源代码+二进制文件+插件SDK v2.2 UPDATE2-152 Kb(Download source code + binaries+ plugin SDK v2.2 UPDATE2 - 152 Kb) (1.8.2005)((1.8.2005))
- 带有对话框源代码的插件SDK 1.0-11.7 Kb(Plug-in SDK 1.0 with Dialog source code - 11.7 Kb) (于15.8.2005更新)((updated on 15.8.2005))
介绍(Introduction)
查看zip内部的手册,以了解新功能.(Take a look at the manual inside the zip to see what’s new.)
为什么选择BatteryX(Why BatteryX)
BatteryX是每个笔记本电脑用户的"必备品".如果您不总是使用鼠标查看Windows电池,请使用此程序. BatteryX几乎不使用任何资源.它具有智能的能源信息系统.默认情况下,BatteryX每35秒自动刷新一次,但用户也可以更改刷新时间.它还使用(BatteryX is a “must have” for each Notebook user. Use this program if you won’t always take a look at the Windows battery using your mouse. BatteryX uses almost no resources. It has an intelligent energy information system. BatteryX refreshes automatically by default every 35 seconds but the user can also change the refresh time. It also uses the)*Windows Power信息消息(Windows Power Information Messages)*刷新.因此,如果您连接到外部电源设备,BatteryX将显示" AC".我使用这两个系统是因为Windows并不总是自动发送电源消息,因此请确保我还设置了刷新间隔.如果您连接到外部电源设备,则当您与外部电源设备断开连接时,间隔计时器将停止并重新启动.该系统节省资源.(to refresh. So, if you connect to an external power device, BatteryX shows you “AC”. I use these two systems because Windows does not always automatically send power massages, so just to be sure I’ve also set a refresh interval. If you are connected to an external power device, the interval timer stops and starts again when you’re disconnected from the external power device. This system saves resources.)
兼容于(Compatible with)
BatteryX专为Win XP或更高版本而设计,但也可能与Win 2K一起使用.(BatteryX is designed for Win XP or higher but should also work probably with Win 2K.)
刷新系统(Refresh system)
基本系统(Basic system)
源代码(Source code)
使用带有最新Service Pack的VC ++ 6.0来编译源代码!!!!如果您想使用VC ++ .NET 2003进行编译,则还可以编译源代码,但是您需要在(Use VC++ 6.0 with the latest service pack to compile the source codes!!! If you want to compile it using VC++ .NET 2003 you’re also able to compile the source but you need to change one parameter in the) GetDevicePowerState
功能.在VC ++ 6.0和VC ++ .NET 2003中,此API似乎有所不同.(function. This API seems to be different in VC++ 6.0 and VC++ .NET 2003.)
如何使用源代码:(How to work with the source:)
如果要在发布模式下编译源,只需在发布模式下选择battery2,否则在调试模式下选择battery2.项目的所有其他部分均以为Battery2选择的模式进行编译.(If you want to compile the source in release mode, just select battery2 in Release mode, otherwise select battery2 in Debug mode. All other parts of the project compiles in the mode which is selected for battery2.)
按Erstellen-> Alles Neuerstellen,以当前所选模式编译项目的所有部分.(Press Erstellen->Alles neu erstellen to compile all parts of the project in the current selected mode.)
看来我可能已经安装了VC ++ 6.0的另一个版本.在我的版本中,我只需要一个参数(It seems that I may have installed another version of VC++ 6.0. With my version, I need just one parameter for) ::GetDevicePowerState
.其他版本需要两个参数,您可以在第二部分中看到.只需编辑此方法即可在您的PC上使用!(. Other versions need two parameters which you can see in the second part here. Just edit this method that works on your pc!!)
使用插件SDK(Working with plug-in SDK)
从2.2版UPDATE2开始,BatteryX还支持动态插件.软件包中还包含插件SDK的源.关于插件支持的主要思想:如果您已经创建了一个好的程序并将其包含到BatteryX中,例如CPU信息,硬件信息,可远程控制的网络摄像头控件,wlan-status等,则只需要包含源代码即可进入SDK,然后使用"开始"方法启动代码.您还必须设置插件版本(仅版本1)和内部名称.您可以在BatteryX的弹出菜单中看到此名称.(Since Version 2.2 UPDATE2 BatteryX supports also dynamic plug-in’s. The source for the plug-in SDK is also included in the package. The main thought on plug-in support: If you’ve created a good program and want to include it into BatteryX, i.e. CPU info, Hardware Info, Remoteable Webcam control, wlan-status etc.., you just need to include the source into the SDK and start your code using the “Start”-method. You must also set the plug-in version, just version 1, and the internal name. This is the name which you can then see in the popup-menu in BatteryX.)
编译插件后,您将获得一个DLL.这是插件.只需将其复制到"(After compiling the plug-in you’ll get a DLL. This is the plug-in. Just copy it into the “)外挂程式(plugins)“中的”(” folder in the)*二进制文件(Binaries)*目录.然后在BatteryX上按鼠标右键.然后您可以看到(directory. Then press the right mouse button on BatteryX. You can then see your)**自己编码(own coded)**弹出菜单中的插件.选择它后,BatteryX会在插件中调用"启动"方法.(plug-in in the pop-up menu. After you’ve select it, BatteryX calls the “Start” method in the plug-in.)
在示例图片中,您可以看到新的插件. “显示对话框的Testplugin"只是内部名称.顺便说一句,您不需要重新启动BatteryX.每次您选择弹出窗口时,都会列出一个新的正确插件列表;).(In the sample picture you can see the new plug-in. “Testplugin which shows a Dialog” is just the internal name. By the way, you don’t need to restart BatteryX. Every time you select the pop-up a new list of correct plug-in’s are listed ;).)
目录看起来像这样…(The directory looks like this…)
**顺便说说(By the way)**注意:如果现在使用STRG-F5进行编译,则会由于位置而加载插件. VC从以下位置启动程序(: If you compile with STRG-F5 now, plug-ins are loaded because of the location. VC starts the program from)电池2(battery2)代替(instead of)battery2 \ Binaries(battery2\Binaries),因此只需直接启动EXE.之后,所有已加载的插件都会在弹出菜单中正确列出.(, so just start the EXE directly. Afterwards all the loaded plug-ins are correctly listed in the popup-menu.)
带对话框的插件SDK 1.0(Plug-in SDK 1.0 with dialog)
我更新了插件SDK v1.0,因为在DLL中启动对话框可能会遇到一些问题.现在,此代码包括一个窗口的MFC类代码和一个名为(I have updated the plug-in SDK v1.0 because you could have some problems to start a dialog in a DLL. This code now includes the MFC class code for a window and a function called) DoModal()
.(.)
void DoModal()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CPluginDialog pd;
pd.DoModal();
}
您需要插入(You need to insert the) AFX_MANAGE_STATE
命令.如果您不包括此行,则对话框不会启动.(command. If you don’t include this line, the dialog does not start.)
学分(Credits)
- 感谢Herbert K.的测试和提示.(Thanks to Herbert K. for testing and hints.)
- 感谢Daniel Chirca为(Thanks to Daniel Chirca for)
CBattery
.(.) - 感谢David Forrester为(Thanks to David Forrester for)
CBitmapDialog
.(.) - 感谢Chris Maunder为(Thanks to Chris Maunder for)
CTestProgressCtrl
.(.) - 感谢Keith Rule(Thanks to Keith Rule for)
CMemDC
类.(class.) - 感谢所有Beta测试人员.(Thanks to all beta testers.)
去做(TODO)
- 自动更新系统.(Automatic updating system.)
- 集成到任务栏!像IBM电池一样.(Integration into Taskbar !! like the IBM battery.)
- 操作系统检查兼容性测试.(Operation system check for compatibility test.)
- 集成语音引擎(可能是一个插件).(Integration of Speech engine (maybe as a plug-in).) 看一眼(Take a look at)*history.txt(histroy.txt)*在包装中查看新功能.如果您有关于如何增强程序的想法,请告诉我.(in the package to see what’s new. If you’ve ideas about how to enhance the program, please let me know.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC6 WinXP Windows Win2K MFC Visual-Studio Dev 新闻 翻译