代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
CSharp
】
调用API获取系统信息
作者:
Dezai.CN
/ 发布于
2011/4/26
/
588
<div> <div> 首先定义外部API导入DLL <div class="cnblogs_Highlighter"> <div id="highlighter_19966" class="syntaxhighlighter csharp"> <div class="bar "> <div class="toolbar"><a style="width: 16px; height: 16px" class="item viewSource" title="view source" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#viewSource">view source</a><a style="width: 16px; height: 16px" class="item printSource" title="print" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#printSource">print</a><a style="width: 16px; height: 16px" class="item about" title="?" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#about">?</a></div> </div> <div class="lines"> <div class="line alt1"> <table> <tbody> <tr> <td class="number">1</td> <td class="content">"csharp plain">[DllImport("csharp string"><font color="#0000ff">"kernel32"</font>"csharp plain">)]</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">2</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">static</font></strong> "csharp keyword"><strong><font color="#006699">extern</font></strong> "csharp keyword"><strong><font color="#006699">void</font></strong> "csharp plain">GetSystemInfo("csharp keyword"><strong><font color="#006699">ref</font></strong> "csharp plain">CPU_INFO cpuinfo);</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">3</td> <td class="content">"csharp plain">[DllImport("csharp string"><font color="#0000ff">"kernel32"</font>"csharp plain">)]</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">4</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">static</font></strong> "csharp keyword"><strong><font color="#006699">extern</font></strong> "csharp keyword"><strong><font color="#006699">void</font></strong> "csharp plain">GlobalMemoryStatus("csharp keyword"><strong><font color="#006699">ref</font></strong> "csharp plain">MEMORY_INFO meminfo);</td> </tr> </tbody> </table> </div> </div> </div> </div> 结构体定义 MEMORY_INFO <div class="cnblogs_Highlighter"> <div id="highlighter_998767" class="syntaxhighlighter csharp"> <div class="bar "> <div class="toolbar"><a style="width: 16px; height: 16px" class="item viewSource" title="view source" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#viewSource">view source</a><a style="width: 16px; height: 16px" class="item printSource" title="print" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#printSource">print</a><a style="width: 16px; height: 16px" class="item about" title="?" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#about">?</a></div> </div> <div class="lines"> <div class="line alt1"> <table> <tbody> <tr> <td class="number">01</td> <td class="content">"csharp plain">[StructLayout( LayoutKind.Sequential)]</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">02</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">struct</font></strong> "csharp plain">MEMORY_INFO</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">03</td> <td class="content">"csharp plain">{</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">04</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwLength;</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">05</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">06</td> <td class="content">"csharp color1"><font color="#808080">/// 被使用内存(百分率)</font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">07</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">08</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwMemoryLoad;</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">09</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">10</td> <td class="content">"csharp color1"><font color="#808080">/// 物理内存(字节)</font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">11</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">12</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwTotalPhys;</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">13</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">14</td> <td class="content">"csharp color1"><font color="#808080">/// 可使用的物理内存(字节)</font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">15</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">16</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwAvailPhys;</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">17</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">18</td> <td class="content">"csharp color1"><font color="#808080">/// 交换文件总大小(字节)</font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">19</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">20</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwTotalPageFile;</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">21</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">22</td> <td class="content">"csharp color1"><font color="#808080">/// 尚可交换文件大小(字节)</font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">23</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">24</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwAvailPageFile;</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">25</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">26</td> <td class="content">"csharp color1"><font color="#808080">/// 总虚拟内存(字节)</font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">27</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">28</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwTotalVirtual;</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">29</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">30</td> <td class="content">"csharp color1"><font color="#808080">/// 未用虚拟内存(字节)</font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">31</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">32</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwAvailVirtual; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">33</td> <td class="content"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">34</td> <td class="content">"csharp plain">}</td> </tr> </tbody> </table> </div> </div> </div> </div> CPU_INFO <div class="cnblogs_Highlighter"> <div id="highlighter_756306" class="syntaxhighlighter csharp"> <div class="bar"> <div class="toolbar"><a style="width: 16px; height: 16px" class="item viewSource" title="view source" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#viewSource">view source</a><a style="width: 16px; height: 16px" class="item printSource" title="print" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#printSource">print</a><a style="width: 16px; height: 16px" class="item about" title="?" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#about">?</a></div> </div> <div class="lines"> <div class="line alt1"> <table> <tbody> <tr> <td class="number">01</td> <td class="content">"csharp plain">[StructLayout(LayoutKind.Sequential)]</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">02</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">struct</font></strong> "csharp plain">CPU_INFO</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">03</td> <td class="content">"csharp plain">{</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">04</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">05</td> <td class="content">"csharp color1"><font color="#808080">/// CPU的OEM_ID</font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">06</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">07</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwOemId;</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">08</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">09</td> <td class="content">"csharp color1"><font color="#808080">/// CPU中的页面大小</font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">10</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">11</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwPageSize;</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">12</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">13</td> <td class="content">"csharp color1"><font color="#808080">/// 最小地址</font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">14</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">15</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">lpMinimumApplicationAddress;</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">16</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">17</td> <td class="content">"csharp color1"><font color="#808080">/// 最大地址</font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">18</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">19</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">lpMaximumApplicationAddress;</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">20</td> <td class="content"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">21</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwActiveProcessorMask;</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">22</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">23</td> <td class="content">"csharp color1"><font color="#808080">/// CPU个数</font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">24</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">25</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwNumberOfProcessors;</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">26</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">27</td> <td class="content">"csharp color1"><font color="#808080">/// CPU的类型</font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">28</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">29</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwProcessorType;</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">30</td> <td class="content"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">31</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwAllocationGranularity;</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">32</td> <td class="content">"csharp color1"><font color="#808080">/// <summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">33</td> <td class="content">"csharp color1"><font color="#808080">/// CPU等级</font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">34</td> <td class="content">"csharp color1"><font color="#808080">/// </summary></font></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">35</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwProcessorLevel;</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">36</td> <td class="content"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">37</td> <td class="content">"csharp keyword"><strong><font color="#006699">public</font></strong> "csharp keyword"><strong><font color="#006699">uint</font></strong> "csharp plain">dwProcessorRevision; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">38</td> <td class="content">"csharp plain">}</td> </tr> </tbody> </table> </div> </div> </div> </div> <div class="cnblogs_Highlighter"> <div id="highlighter_472896" class="syntaxhighlighter csharp"> <div class="bar show"> <div class="toolbar"><a style="width: 16px; height: 16px" class="item viewSource" title="view source" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#viewSource">view source</a><a style="width: 16px; height: 16px" class="item printSource" title="print" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#printSource">print</a><a style="width: 16px; height: 16px" class="item about" title="?" href="http://www.cnblogs.com/NatureSex/archive/2011/04/26/2029117.html#about">?</a></div> </div> <div class="lines"> <div class="line alt1"> <table> <tbody> <tr> <td class="number">01</td> <td class="content">"csharp comments"><font color="#008200">//调用GetSystemInfo函数获取CPU的相关信息</font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">02</td> <td class="content">"csharp plain">CPU_INFO CpuInfo;</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">03</td> <td class="content">"csharp plain">CpuInfo = "csharp keyword"><strong><font color="#006699">new</font></strong> "csharp plain">CPU_INFO();</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">04</td> <td class="content">"csharp plain">GetSystemInfo("csharp keyword"><strong><font color="#006699">ref</font></strong> "csharp plain">CpuInfo);</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">05</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"本计算机中有"</font> "csharp plain">+ CpuInfo.dwNumberOfProcessors.ToString() + "csharp string"><font color="#0000ff">"个CPU"</font>"csharp plain">);</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">06</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"CPU的类型为"</font> "csharp plain">+ CpuInfo.dwProcessorType.ToString());</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">07</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"CPU等级为"</font> "csharp plain">+ CpuInfo.dwProcessorLevel.ToString());</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">08</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"CPU的OEM ID为"</font> "csharp plain">+ CpuInfo.dwOemId.ToString());</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">09</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"CPU中的页面大小为"</font> "csharp plain">+ CpuInfo.dwPageSize.ToString());</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">10</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">""</font> "csharp plain">+ CpuInfo.dwActiveProcessorMask.ToString());</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">11</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">""</font> "csharp plain">+ CpuInfo.dwAllocationGranularity.ToString());</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">12</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">""</font> "csharp plain">+ CpuInfo.dwProcessorRevision.ToString());</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">13</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">""</font> "csharp plain">+ CpuInfo.lpMaximumApplicationAddress.ToString());</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">14</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">""</font> "csharp plain">+ CpuInfo.lpMinimumApplicationAddress.ToString());</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">15</td> <td class="content">"csharp comments"><font color="#008200">//调用GlobalMemoryStatus函数获取内存的相关信息</font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">16</td> <td class="content">"csharp plain">MEMORY_INFO MemInfo;</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">17</td> <td class="content">"csharp plain">MemInfo = "csharp keyword"><strong><font color="#006699">new</font></strong> "csharp plain">MEMORY_INFO();</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">18</td> <td class="content">"csharp plain">GlobalMemoryStatus("csharp keyword"><strong><font color="#006699">ref</font></strong> "csharp plain">MemInfo);</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">19</td> <td class="content">"csharp comments"><font color="#008200">//感觉的这个使用率有点假</font></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">20</td> <td class="content">"csharp plain">Console.WriteLine(MemInfo.dwMemoryLoad.ToString() + "csharp string"><font color="#0000ff">"%的内存正在使用"</font>"csharp plain">);</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">21</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"物理内存共有"</font> "csharp plain">+ ((MemInfo.dwTotalPhys/1024)/1024).ToString() + "csharp string"><font color="#0000ff">"MB"</font>"csharp plain">);</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">22</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"可使用的物理内存有"</font> "csharp plain">+ ((MemInfo.dwAvailPhys/1024)/1024).ToString() + "csharp string"><font color="#0000ff">"MB"</font>"csharp plain">);</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">23</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"交换文件总大小为"</font> "csharp plain">+ ((MemInfo.dwTotalPageFile/1024)/1024).ToString() + "csharp string"><font color="#0000ff">"MB"</font>"csharp plain">);</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">24</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"尚可交换文件大小为"</font> "csharp plain">+ ((MemInfo.dwAvailPageFile/1024)/1024).ToString() + "csharp string"><font color="#0000ff">"MB"</font>"csharp plain">);</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">25</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"总虚拟内存有"</font> "csharp plain">+ ((MemInfo.dwTotalVirtual/1024)/1024).ToString() + "csharp string"><font color="#0000ff">"MB"</font>"csharp plain">);</td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">26</td> <td class="content">"csharp plain">Console.WriteLine("csharp string"><font color="#0000ff">"未用虚拟内存有"</font> "csharp plain">+ ((MemInfo.dwAvailVirtual/1024)/1024).ToString() + "csharp string"><font color="#0000ff">"MB"</font>"csharp plain">);</td> </tr> </tbody> </table> </div> </div> </div> </div> </div> </div>
试试其它关键字
系统信息
同语言下
.
文件IO 操作类库
.
Check图片类型[JPEG(.jpg 、.jpeg),TIF,GIF,BMP,PNG,P
.
机器名和IP取得(IPV4 IPV6)
.
Tiff转换Bitmap
.
linqHelper
.
MadieHelper.cs
.
RegHelper.cs
.
如果关闭一个窗体后激活另一个窗体的事件或方法
.
创建日志通用类
.
串口辅助开发类
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
Dezai.CN
贡献的其它代码
(
4037
)
.
多线程Socket服务器模块
.
生成随机密码
.
清除浮动样式
.
弹出窗口居中
.
抓取url的函数
.
使用base HTTP验证
.
div模拟iframe嵌入效果
.
通过header转向的方法
.
Session操作类
.
执行sqlite输入插入操作后获得自动编号的ID
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3