主题 : SystemInfo Test        By Fengwuji
If you put your heart into it,nothing is impossible!
级别: 技术组成员

UID: 85553
精华: 2
发帖: 124
威望: 768 点
无痕币: 3522 WHB
贡献值: 0 点
在线时间: 171(时)
注册时间: 2009-06-27
最后登录: 2013-12-09

0 SystemInfo Test        By Fengwuji

管理提醒: 本帖被 秋无痕 执行加亮操作(2010-10-17)
上图:




功能自己看了~~~~

风无忌

2010年10月17日

源码:(CPU部分参考网上资料)

复制代码
  1. #Region AutoIt3Wrapper 预编译参数(常用参数)
  2. #AutoIt3Wrapper_Icon= D:\Downloads\win7_icons\cool0 Icon 152.ico    ;图标,支持EXE,DLL,ICO
  3. #AutoIt3Wrapper_OutFile=         ;输出文件名
  4. #AutoIt3Wrapper_OutFile_Type=exe       ;文件类型
  5. #AutoIt3Wrapper_Compression=4        ;压缩等级
  6. #AutoIt3Wrapper_UseUPX=y          ;使用压缩
  7. #AutoIt3Wrapper_Res_Comment= SystemInfo Test By FengWuji ;注释
  8. #AutoIt3Wrapper_Res_Description=检测系统信息   ;详细信息
  9. #AutoIt3Wrapper_Res_FileVersion= 1.0.0      ;文件版本
  10. ;#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p   ;自动更新版本
  11. #AutoIt3Wrapper_Res_LegalCopyright= 风无忌     ;版权
  12. #AutoIt3Wrapper_Change2CUI=N                       ;修改输出的程序为CUI(控制台程序)
  13. ;#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer%  ;自定义资源段
  14. ;#AutoIt3Wrapper_Run_Tidy=                       ;脚本整理
  15. ;#AutoIt3Wrapper_Run_Obfuscator=            ;代码迷惑
  16. ;#AutoIt3Wrapper_Run_AU3Check=         ;语法检查
  17. ;#AutoIt3Wrapper_Run_Before=         ;运行前
  18. ;#AutoIt3Wrapper_Run_After=         ;运行后
  19. #EndRegion AutoIt3Wrapper 预编译参数(常用参数)
  20. #cs ____________________________________
  21.  
  22.  Au3 版本:                          3.3.6.1
  23.  脚本作者:                          FengWuji
  24.  Email:           wzh880801@163.com
  25.  QQ/TM:           545144121
  26.  脚本版本:                          1.0.0
  27.  脚本功能:          Systeminfo Test
  28.  
  29. #ce _______________脚本开始_________________
  30. #include <ButtonConstants.au3>
  31. #include <GUIConstantsEx.au3>
  32. #include <ProgressConstants.au3>
  33. #include <StaticConstants.au3>
  34. #include <WindowsConstants.au3>
  35. #Region ### START Koda GUI section ### Form=g:\auouit 3\我写的程序\form7.kxf
  36. Global $IDLETIME, $KERNELTIME, $USERTIME
  37. Global $StartIdle, $StartKernel, $StartUser
  38. Global $EndIdle, $EndKernel, $EndUser
  39. FileInstall("SkinCrafterDll.dll", @TempDir & "\SkinCrafterDll.dll", 1)
  40. FileInstall("vista_style.skf", @TempDir & "\vista_style.skf", 1)
  41. $Dll = DllOpen(@TempDir & "\SkinCrafterDll.dll")
  42. $Form1 = GUICreate("SystemInfo Test                            By FengWuji", 493, 442, -1, -1)
  43. DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
  44. DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
  45. DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", @TempDir & "\vista_style.skf")
  46. DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Form1, "int", 25)
  47. DllCall($Dll, "int:cdecl", "ApplySkin")
  48. $Label1 = GUICtrlCreateLabel("", 160, 8, 196, 17)
  49. $Group1 = GUICtrlCreateGroup("操作系统信息", 24, 32, 449, 121)
  50. $Label2 = GUICtrlCreateLabel("操作系统:", 48, 56, 55, 17)
  51. $Label3 = GUICtrlCreateLabel("", 157, 56, 175, 17)
  52. $Label4 = GUICtrlCreateLabel("Service Pack:", 48, 84, 78, 17)
  53. $Label5 = GUICtrlCreateLabel("", 157, 84, 116, 17)
  54. $Label6 = GUICtrlCreateLabel("系统构架:", 48, 113, 55, 17)
  55. $Label7 = GUICtrlCreateLabel("X86", 157, 113, 63, 17)
  56. GUICtrlCreateGroup("", -99, -99, 1, 1)
  57. $Group2 = GUICtrlCreateGroup("当前用户信息", 24, 168, 449, 57)
  58. $Label8 = GUICtrlCreateLabel("计算机名:", 40, 192, 55, 17)
  59. $Label9 = GUICtrlCreateLabel("登录用户名:", 248, 192, 67, 17)
  60. $Label10 = GUICtrlCreateLabel("", 109, 192, 90, 17)
  61. $Label11 = GUICtrlCreateLabel("", 332, 192, 100, 17)
  62. GUICtrlCreateGroup("", -99, -99, 1, 1)
  63. $Group3 = GUICtrlCreateGroup("其它信息", 24, 240, 449, 137)
  64. $Label12 = GUICtrlCreateLabel("屏幕分辨率:", 40, 264, 67, 17)
  65. $Label13 = GUICtrlCreateLabel("", 119, 264, 58, 17)
  66. $Label14 = GUICtrlCreateLabel("屏幕色深:", 40, 302, 55, 17)
  67. $Label15 = GUICtrlCreateLabel("", 120, 302, 44, 17)
  68. $Label16 = GUICtrlCreateLabel("屏幕刷新率:", 39, 340, 67, 17)
  69. $Label17 = GUICtrlCreateLabel("", 120, 340, 56, 17)
  70. $Group4 = GUICtrlCreateGroup("内存信息", 200, 256, 265, 105)
  71. $Label18 = GUICtrlCreateLabel("内存使用率:", 208, 275, 67, 17)
  72. $Progress1 = GUICtrlCreateProgress(303, 272, 113, 17)
  73. GUICtrlSetData(-1, 80)
  74. $Label19 = GUICtrlCreateLabel("CPU使用率:", 208, 301, 91, 17)
  75. $Progress2 = GUICtrlCreateProgress(303, 299, 113, 17)
  76. GUICtrlSetData(-1, 50)
  77. $Label20 = GUICtrlCreateLabel("虚拟内存使用率:", 208, 328, 91, 17)
  78. $Progress3 = GUICtrlCreateProgress(303, 327, 113, 17)
  79. GUICtrlSetData(-1, 10)
  80. $Label21 = GUICtrlCreateLabel("", 425, 274, 24, 17)
  81. $Label22 = GUICtrlCreateLabel("", 425, 301, 24, 17)
  82. $Label23 = GUICtrlCreateLabel("", 425, 329, 24, 17)
  83. GUICtrlCreateGroup("", -99, -99, 1, 1)
  84. GUICtrlCreateGroup("", -99, -99, 1, 1)
  85. $Button1 = GUICtrlCreateButton("确定(&O)", 128, 392, 89, 25)
  86. $Button2 = GUICtrlCreateButton("取消(&E)", 265, 392, 89, 25)
  87. GUISetState(@SW_SHOW)
  88. #EndRegion ### END Koda GUI section ###
  89. Time()
  90. CheckOS()
  91. UserInfo()
  92. OtherInfo()
  93. MemInfo()
  94. _CRR_Main()
  95. AdlibRegister("time")
  96. AdlibRegister('MemInfo', 10)
  97. AdlibRegister('_TrayTooltip')
  98. While 1
  99.  $nMsg = GUIGetMsg()
  100.  Switch $nMsg
  101.   Case $GUI_EVENT_CLOSE
  102.    Exit
  103.   Case $Button1, $Button2
  104.    Exit
  105.  EndSwitch
  106. WEnd
  107. ;时间函数
  108. Func Time()
  109.  Local $wday
  110.  Switch @WDAY
  111.   Case 1
  112.    $wday = "星期天"
  113.   Case 2
  114.    $wday = "星期一"
  115.   Case 3
  116.    $wday = "星期二"
  117.   Case 4
  118.    $wday = "星期三"
  119.   Case 5
  120.    $wday = "星期四"
  121.   Case 6
  122.    $wday = "星期五"
  123.   Case 7
  124.    $wday = "星期六"
  125.  EndSwitch
  126.  Local $time = @YEAR & "年" & @MON & "月" & @MDAY & "日" & " " & $wday & " " & @HOUR & ":" & @MIN & ":" & @SEC
  127.  GUICtrlSetData($Label1, $time)
  128. EndFunc   ;==>Time
  129. Func CheckOS()
  130.  Local $Osversion = @OSVersion
  131.  Switch $Osversion
  132.   Case "WIN_2008R2"
  133.    GUICtrlSetData($Label3, "Microsoft Windows 2008R2")
  134.   Case "WIN_7"
  135.    GUICtrlSetData($Label3, "Microsoft Windows 7")
  136.   Case "WIN_2008"
  137.    GUICtrlSetData($Label3, "Microsoft Windows 2008")
  138.   Case "WIN_VISTA"
  139.    GUICtrlSetData($Label3, "Microsoft Windows Vista")
  140.   Case "WIN_2003"
  141.    GUICtrlSetData($Label3, "Microsoft Windows 2003")
  142.   Case "WIN_XP"
  143.    GUICtrlSetData($Label3, "Microsoft Windows XP")
  144.   Case "WIN_XPe"
  145.    GUICtrlSetData($Label3, "Microsoft Windows XPE")
  146.   Case "WIN_2000"
  147.    GUICtrlSetData($Label3, "Microsoft Windows 2000")
  148.  EndSwitch
  149.  GUICtrlSetData($Label5, @OSServicePack)
  150.  GUICtrlSetData($Label7, @OSArch)
  151. EndFunc   ;==>CheckOS
  152. Func UserInfo()
  153.  GUICtrlSetData($Label10, @ComputerName)
  154.  GUICtrlSetData($Label11, @UserName)
  155. EndFunc   ;==>UserInfo
  156. Func OtherInfo()
  157.  GUICtrlSetData($Label13, @DesktopWidth & "×" & @DesktopHeight)
  158.  GUICtrlSetData($Label15, @DesktopDepth & " 位")
  159.  GUICtrlSetData($Label17, @DesktopRefresh & " 赫兹")
  160. EndFunc   ;==>OtherInfo
  161. Func MemInfo()
  162.  Local $array = MemGetStats()
  163.  GUICtrlSetData($Progress1, $array[0])
  164.  GUICtrlSetData($Label21, $array[0] & '%')
  165.  GUICtrlSetData($Progress3, Round(1 - $array[6] / $array[5], 1))
  166.  GUICtrlSetData($Label23, Round(1 - $array[6] / $array[5], 1) & '%')
  167. EndFunc   ;==>MemInfo
  168. Func _TrayTooltip()
  169.  TraySetToolTip(GUICtrlRead($Label1) & @LF & "                     By 风无忌")
  170. EndFunc   ;==>_TrayTooltip
  171. Func _CRR_Main()
  172.  $IDLETIME = DllStructCreate("dword;dword")
  173.  $KERNELTIME = DllStructCreate("dword;dword")
  174.  $USERTIME = DllStructCreate("dword;dword")
  175.  AdlibRegister("_TimerProc")
  176. EndFunc   ;==>_CRR_Main
  177. Func _TimerProc()
  178.  _GetSysTime($EndIdle, $EndKernel, $EndUser)
  179.  _CPUCalc()
  180.  _GetSysTime($StartIdle, $StartKernel, $StartUser)
  181. EndFunc   ;==>_TimerProc
  182. Func _GetSysTime(ByRef $sIdle, ByRef $sKernel, ByRef $sUser)
  183.  DllCall("kernel32.dll", "int", "GetSystemTimes", "ptr", DllStructGetPtr($IDLETIME), _
  184.    "ptr", DllStructGetPtr($KERNELTIME), _
  185.    "ptr", DllStructGetPtr($USERTIME))
  186.  $sIdle = DllStructGetData($IDLETIME, 1)
  187.  $sKernel = DllStructGetData($KERNELTIME, 1)
  188.  $sUser = DllStructGetData($USERTIME, 1)
  189. EndFunc   ;==>_GetSysTime
  190. Func _CPUCalc()
  191.  Local $iSystemTime, $iTotal, $iCalcIdle, $iCalcKernel, $iCalcUser
  192.  $iCalcIdle = ($EndIdle - $StartIdle)
  193.  $iCalcKernel = ($EndKernel - $StartKernel)
  194.  $iCalcUser = ($EndUser - $StartUser)
  195.  $iSystemTime = ($iCalcKernel + $iCalcUser)
  196.  $iTotal = Int(($iSystemTime - $iCalcIdle) * (100 / $iSystemTime))
  197.  Local $CPU = $iTotal
  198.  If $CPU & "%" <> GUICtrlRead($Label22) And ($CPU >= 0 And $CPU <= 100) Then
  199.   GUICtrlSetData($Progress2, $CPU)
  200.   GUICtrlSetData($Label22, $CPU & "%")
  201.  EndIf
  202. EndFunc   ;==>_CPUCalc

下载地址:
http://u.115.com/file/f547c38d81
[ 此帖被风无忌在2010-10-17 14:50重新编辑 ]
附件: SystemInfo Test.haozip01.zip (196 K) 下载次数:7
附件: SystemInfo Test.haozip02.zip (196 K) 下载次数:5
附件: SystemInfo Test.haozip03.zip (196 K) 下载次数:5
附件: SystemInfo Test.haozip04.zip (112 K) 下载次数:5
附件: SystemInfo Test.zip (3 K) 下载次数:6
附件: SystemInfo Test.zip_好压分卷说明.txt (1 K) 下载次数:4
本帖最近评分记录:
  • 无痕币:+50(秋无痕) 原创内容
  • 无限追求,超越自我!
    级别: 七朵秋菊
    UID: 99415
    精华: 0
    发帖: 3227
    威望: 30597 点
    无痕币: 17155 WHB
    贡献值: 0 点
    在线时间: 700(时)
    注册时间: 2010-07-20
    最后登录: 2024-03-28

    了解学习一下了,感谢分享了
    Total 0.064312(s) query 4, Time now is:03-29 07:33, Gzip enabled 粤ICP备07514325号-1
    Powered by PHPWind v7.3.2 Certificate Code © 2003-13 秋无痕论坛