⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 在屏幕顶端显示电量和内存用量(页 1) - 手机软件开发 - windows mobile开发 - 数字论坛 - powered by discuz! archiver.htm

📁 wince 电池电源管理文件集 wince 电池电源管理文件集
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0045)http://www.diclife.com/archiver/?tid-325.html -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>在屏幕顶端显示电量和内存用量(页 1) - 手机软件开发 - Windows Mobile开发 - 数字论坛 - Powered by Discuz! Archiver</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="Discuz!,Board,Comsenz,forums,bulletin board," name=keywords>
<META 
content="[size=12px]这段代码出处忘了,就是在屏幕顶端显示电量和内存用量/ mybatt.cpp : Defines the entry point for the application.//#include " 
name=description Archiver? Discuz! - 数字论坛 ... HINSTANCE WinMain( WINAPI 
stdafx.h?int>
<META content="MSHTML 6.00.2900.3157" name=GENERATOR>
<META content="Discuz! Team &amp; Comsenz UI Team" name=author>
<META content="2001-2007 Comsenz Inc." name=copyright><LINK 
href="在屏幕顶端显示电量和内存用量(页 1) - 手机软件开发 - Windows Mobile开发 - 数字论坛 - Powered by Discuz! Archiver.files/style_1.css" 
type=text/css rel=stylesheet>
<STYLE type=text/css></STYLE>
</HEAD>
<BODY class=archiver>
<DIV class=archiver_banner><A href="http://www.tang300.com/" target=_blank><IMG 
alt=唐300 
src="在屏幕顶端显示电量和内存用量(页 1) - 手机软件开发 - Windows Mobile开发 - 数字论坛 - Powered by Discuz! Archiver.files/tang300.jpg" 
vspace=5 border=0></A> </DIV>
<DIV class=wrap>
<DIV id=nav><A href="http://www.diclife.com/archiver/">数字论坛</A> » <A 
href="http://www.diclife.com/archiver/?fid-19.html">手机软件开发</A> <B>»</B> <A 
href="http://www.diclife.com/archiver/?fid-14.html">Windows Mobile开发</A> » 
在屏幕顶端显示电量和内存用量</DIV>
<H1><A href="http://www.diclife.com/viewthread.php?tid=325" 
target=_blank>查看完整版本: 在屏幕顶端显示电量和内存用量</A></H1>
<DIV class=archiver_post>
<P><CITE>leo</CITE> 2007-3-21 00:01</P>
<DIV class=archiver_postbody>
<H2>在屏幕顶端显示电量和内存用量</H2>[size=12px]这段代码出处忘了,就是在屏幕顶端显示电量和内存用量<BR><BR>/ mybatt.cpp 
: Defines the entry point for the application.<BR>//<BR><BR>#include 
"stdafx.h"<BR><BR>int WINAPI WinMain(&nbsp; &nbsp;HINSTANCE hInstance, 
<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;HINSTANCE 
hPrevInstance, <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;LPTSTR&nbsp; &nbsp; lpCmdLine, <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;int&nbsp; &nbsp;&nbsp; &nbsp; nCmdShow) <BR>{ 
<BR>&nbsp; &nbsp; // TODO: Place code here. <BR>&nbsp; 
&nbsp;SYSTEM_POWER_STATUS_EX pst; <BR>&nbsp; &nbsp;int i,cx,dx,ex,top,c; 
<BR>&nbsp; &nbsp;HDC hdc = ::GetDC(NULL); <BR>&nbsp; &nbsp; <BR>&nbsp; 
&nbsp;HPEN pe,pb,po,pm; <BR><BR>&nbsp; &nbsp;pe = 
CreatePen(PS_SOLID,2,RGB(50,200,50)); <BR>&nbsp; &nbsp;pm = 
CreatePen(PS_SOLID,2,RGB(250,150,50)); <BR>&nbsp; &nbsp;pb = 
CreatePen(PS_SOLID,2,RGB(80,80,80)); <BR>&nbsp; &nbsp;i=30; <BR>&nbsp; &nbsp;top 
= 1; <BR>&nbsp; &nbsp;c=0; <BR><BR>&nbsp; &nbsp; <BR>&nbsp; &nbsp;while(1) 
<BR>&nbsp; &nbsp;{ <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<BR>&nbsp; 
&nbsp;&nbsp; &nbsp;i++; <BR>&nbsp; &nbsp;&nbsp; &nbsp;if(i&gt;15){ <BR>&nbsp; 
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;i=0; <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;GetSystemPowerStatusEx(&amp;pst,true); <BR>&nbsp; &nbsp;&nbsp; 
&nbsp;&nbsp; &nbsp;if (pst.ACLineStatus==1) <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;{ <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;pst.BatteryLifePercent=c; <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;&nbsp; &nbsp;c+=25;if(c&gt;100)c=0; <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;} <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;cx = 
GetSystemMetrics(SM_CXSCREEN) / 2; <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;dx 
= (int)(cx * pst.BatteryLifePercent / 100.0); <BR><BR>&nbsp; &nbsp;&nbsp; 
&nbsp;&nbsp; &nbsp;STORE_INFORMATION ss; <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;GetStoreInformation(&amp;ss); <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 
<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;MEMORYSTATUS ms; <BR>&nbsp; 
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;GlobalMemoryStatus(&amp;ms); <BR>&nbsp; 
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
&nbsp;float mfree; <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;mfree = 
1.0f/(ss.dwStoreSize+ms.dwTotalPhys)*(ss.dwFreeSize+ms.dwAvailPhys) ;//+ 
ms.dwMemoryLoad) / 2; <BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; <BR>&nbsp; 
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;ex = (int)(cx * mfree); <BR>&nbsp; &nbsp;&nbsp; 
&nbsp;&nbsp; &nbsp; <BR><BR>&nbsp; &nbsp;&nbsp; &nbsp;} <BR>&nbsp; &nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;<BR><BR>&nbsp; &nbsp;&nbsp; &nbsp;MoveToEx(hdc,0,top,NULL); 
<BR><BR>&nbsp; &nbsp;&nbsp; &nbsp;po = (HPEN)SelectObject(hdc,pe); <BR>&nbsp; 
&nbsp;&nbsp; &nbsp;LineTo(hdc,dx,top); <BR><BR>&nbsp; &nbsp;&nbsp; 
&nbsp;SelectObject(hdc,pb); <BR>&nbsp; &nbsp;&nbsp; &nbsp;LineTo(hdc,cx,top); 
<BR><BR>&nbsp; &nbsp;&nbsp; &nbsp;SelectObject(hdc,pm); <BR>&nbsp; &nbsp;&nbsp; 
&nbsp;LineTo(hdc,ex +cx,top); <BR><BR>&nbsp; &nbsp;&nbsp; 
&nbsp;SelectObject(hdc,pb); <BR>&nbsp; &nbsp;&nbsp; &nbsp;LineTo(hdc,cx*2,top); 
<BR><BR><BR>&nbsp; &nbsp;&nbsp; &nbsp;SelectObject(hdc,po); <BR>&nbsp; 
&nbsp;&nbsp; &nbsp;Sleep(100); <BR>&nbsp; &nbsp;} <BR><BR>&nbsp; 
&nbsp;DeleteObject(pe); <BR>&nbsp; &nbsp;DeleteObject(pm); <BR>&nbsp; 
&nbsp;DeleteObject(pb); <BR><BR>&nbsp; &nbsp;::ReleaseDC(NULL, hdc); <BR>&nbsp; 
&nbsp;return 0; <BR>}[/size]</DIV></DIV>
<DIV class=archiver_pages>页: <STRONG>[1]</STRONG> </DIV>
<DIV class=archiver_fullversion>查看完整版本: <STRONG><A 
href="http://www.diclife.com/viewthread.php?tid=325" 
target=_blank>在屏幕顶端显示电量和内存用量</A></STRONG></DIV></DIV>
<P id=copyright>Powered by <STRONG><A href="http://www.discuz.net/" 
target=_blank>Discuz! Archiver</A></STRONG> <EM>6.0.0</EM>&nbsp; © 2001-2006 <A 
href="http://www.comsenz.com/" target=_blank>Comsenz 
Inc.</A><BR><BR></P></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -