查看完整版本: [-- SystemInfo Test        By Fengwuji --]

秋无痕论坛 -> 『秋无痕原创作品发布』 -> SystemInfo Test        By Fengwuji [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

风无忌 2010-10-17 01:19

上图:

[attachment=87738]

功能自己看了~~~~

风无忌

2010年10月17日

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

复制代码

  1. #Region AutoIt3Wrapper 预编译参数(常用参数)
    #AutoIt3Wrapper_Icon= D:\Downloads\win7_icons\cool0 Icon 152.ico    ;图标,支持EXE,DLL,ICO
    #AutoIt3Wrapper_OutFile=         ;输出文件名
    #AutoIt3Wrapper_OutFile_Type=exe       ;文件类型
    #AutoIt3Wrapper_Compression=4        ;压缩等级
    #AutoIt3Wrapper_UseUPX=y          ;使用压缩
    #AutoIt3Wrapper_Res_Comment= SystemInfo Test By FengWuji ;注释
    #AutoIt3Wrapper_Res_Description=检测系统信息   ;详细信息
    #AutoIt3Wrapper_Res_FileVersion= 1.0.0      ;文件版本
    ;#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p   ;自动更新版本
    #AutoIt3Wrapper_Res_LegalCopyright= 风无忌     ;版权
    #AutoIt3Wrapper_Change2CUI=N                       ;修改输出的程序为CUI(控制台程序)
    ;#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer%  ;自定义资源段
    ;#AutoIt3Wrapper_Run_Tidy=                       ;脚本整理
    ;#AutoIt3Wrapper_Run_Obfuscator=            ;代码迷惑
    ;#AutoIt3Wrapper_Run_AU3Check=         ;语法检查
    ;#AutoIt3Wrapper_Run_Before=         ;运行前
    ;#AutoIt3Wrapper_Run_After=         ;运行后
    #EndRegion AutoIt3Wrapper 预编译参数(常用参数)
    #cs ____________________________________
     
     Au3 版本:                          3.3.6.1
     脚本作者:                          FengWuji
     Email:           wzh880801@163.com
     QQ/TM:           545144121
     脚本版本:                          1.0.0
     脚本功能:          Systeminfo Test
     
    #ce _______________脚本开始_________________
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=g:\auouit 3\我写的程序\form7.kxf
    Global $IDLETIME, $KERNELTIME, $USERTIME
    Global $StartIdle, $StartKernel, $StartUser
    Global $EndIdle, $EndKernel, $EndUser
    FileInstall("SkinCrafterDll.dll", @TempDir & "\SkinCrafterDll.dll", 1)
    FileInstall("vista_style.skf", @TempDir & "\vista_style.skf", 1)
    $Dll = DllOpen(@TempDir & "\SkinCrafterDll.dll")
    $Form1 = GUICreate("SystemInfo Test                            By FengWuji", 493, 442, -1, -1)
    DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
    DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
    DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", @TempDir & "\vista_style.skf")
    DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Form1, "int", 25)
    DllCall($Dll, "int:cdecl", "ApplySkin")
    $Label1 = GUICtrlCreateLabel("", 160, 8, 196, 17)
    $Group1 = GUICtrlCreateGroup("操作系统信息", 24, 32, 449, 121)
    $Label2 = GUICtrlCreateLabel("操作系统:", 48, 56, 55, 17)
    $Label3 = GUICtrlCreateLabel("", 157, 56, 175, 17)
    $Label4 = GUICtrlCreateLabel("Service Pack:", 48, 84, 78, 17)
    $Label5 = GUICtrlCreateLabel("", 157, 84, 116, 17)
    $Label6 = GUICtrlCreateLabel("系统构架:", 48, 113, 55, 17)
    $Label7 = GUICtrlCreateLabel("X86", 157, 113, 63, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group2 = GUICtrlCreateGroup("当前用户信息", 24, 168, 449, 57)
    $Label8 = GUICtrlCreateLabel("计算机名:", 40, 192, 55, 17)
    $Label9 = GUICtrlCreateLabel("登录用户名:", 248, 192, 67, 17)
    $Label10 = GUICtrlCreateLabel("", 109, 192, 90, 17)
    $Label11 = GUICtrlCreateLabel("", 332, 192, 100, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group3 = GUICtrlCreateGroup("其它信息", 24, 240, 449, 137)
    $Label12 = GUICtrlCreateLabel("屏幕分辨率:", 40, 264, 67, 17)
    $Label13 = GUICtrlCreateLabel("", 119, 264, 58, 17)
    $Label14 = GUICtrlCreateLabel("屏幕色深:", 40, 302, 55, 17)
    $Label15 = GUICtrlCreateLabel("", 120, 302, 44, 17)
    $Label16 = GUICtrlCreateLabel("屏幕刷新率:", 39, 340, 67, 17)
    $Label17 = GUICtrlCreateLabel("", 120, 340, 56, 17)
    $Group4 = GUICtrlCreateGroup("内存信息", 200, 256, 265, 105)
    $Label18 = GUICtrlCreateLabel("内存使用率:", 208, 275, 67, 17)
    $Progress1 = GUICtrlCreateProgress(303, 272, 113, 17)
    GUICtrlSetData(-1, 80)
    $Label19 = GUICtrlCreateLabel("CPU使用率:", 208, 301, 91, 17)
    $Progress2 = GUICtrlCreateProgress(303, 299, 113, 17)
    GUICtrlSetData(-1, 50)
    $Label20 = GUICtrlCreateLabel("虚拟内存使用率:", 208, 328, 91, 17)
    $Progress3 = GUICtrlCreateProgress(303, 327, 113, 17)
    GUICtrlSetData(-1, 10)
    $Label21 = GUICtrlCreateLabel("", 425, 274, 24, 17)
    $Label22 = GUICtrlCreateLabel("", 425, 301, 24, 17)
    $Label23 = GUICtrlCreateLabel("", 425, 329, 24, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Button1 = GUICtrlCreateButton("确定(&O)", 128, 392, 89, 25)
    $Button2 = GUICtrlCreateButton("取消(&E)", 265, 392, 89, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    Time()
    CheckOS()
    UserInfo()
    OtherInfo()
    MemInfo()
    _CRR_Main()
    AdlibRegister("time")
    AdlibRegister('MemInfo', 10)
    AdlibRegister('_TrayTooltip')
    While 1
     $nMsg = GUIGetMsg()
     Switch $nMsg
      Case $GUI_EVENT_CLOSE
       Exit
      Case $Button1, $Button2
       Exit
     EndSwitch
    WEnd

    ;时间函数
    Func Time()
     Local $wday
     Switch @WDAY
      Case 1
       $wday = "星期天"
      Case 2
       $wday = "星期一"
      Case 3
       $wday = "星期二"
      Case 4
       $wday = "星期三"
      Case 5
       $wday = "星期四"
      Case 6
       $wday = "星期五"
      Case 7
       $wday = "星期六"
     EndSwitch
     Local $time = @YEAR & "年" & @MON & "月" & @MDAY & "日" & " " & $wday & " " & @HOUR & ":" & @MIN & ":" & @SEC
     GUICtrlSetData($Label1, $time)
    EndFunc   ;==>Time
    Func CheckOS()
     Local $Osversion = @OSVersion
     Switch $Osversion
      Case "WIN_2008R2"
       GUICtrlSetData($Label3, "Microsoft Windows 2008R2")
      Case "WIN_7"
       GUICtrlSetData($Label3, "Microsoft Windows 7")
      Case "WIN_2008"
       GUICtrlSetData($Label3, "Microsoft Windows 2008")
      Case "WIN_VISTA"
       GUICtrlSetData($Label3, "Microsoft Windows Vista")
      Case "WIN_2003"
       GUICtrlSetData($Label3, "Microsoft Windows 2003")
      Case "WIN_XP"
       GUICtrlSetData($Label3, "Microsoft Windows XP")
      Case "WIN_XPe"
       GUICtrlSetData($Label3, "Microsoft Windows XPE")
      Case "WIN_2000"
       GUICtrlSetData($Label3, "Microsoft Windows 2000")
     EndSwitch
     GUICtrlSetData($Label5, @OSServicePack)
     GUICtrlSetData($Label7, @OSArch)
    EndFunc   ;==>CheckOS
    Func UserInfo()
     GUICtrlSetData($Label10, @ComputerName)
     GUICtrlSetData($Label11, @UserName)
    EndFunc   ;==>UserInfo
    Func OtherInfo()
     GUICtrlSetData($Label13, @DesktopWidth & "×" & @DesktopHeight)
     GUICtrlSetData($Label15, @DesktopDepth & " 位")
     GUICtrlSetData($Label17, @DesktopRefresh & " 赫兹")
    EndFunc   ;==>OtherInfo
    Func MemInfo()
     Local $array = MemGetStats()
     GUICtrlSetData($Progress1, $array[0])
     GUICtrlSetData($Label21, $array[0] & '%')
     GUICtrlSetData($Progress3, Round(1 - $array[6] / $array[5], 1))
     GUICtrlSetData($Label23, Round(1 - $array[6] / $array[5], 1) & '%')
    EndFunc   ;==>MemInfo
    Func _TrayTooltip()
     TraySetToolTip(GUICtrlRead($Label1) & @LF & "                     By 风无忌")
    EndFunc   ;==>_TrayTooltip
    Func _CRR_Main()
     $IDLETIME = DllStructCreate("dword;dword")
     $KERNELTIME = DllStructCreate("dword;dword")
     $USERTIME = DllStructCreate("dword;dword")
     AdlibRegister("_TimerProc")
    EndFunc   ;==>_CRR_Main
    Func _TimerProc()
     _GetSysTime($EndIdle, $EndKernel, $EndUser)
     _CPUCalc()
     _GetSysTime($StartIdle, $StartKernel, $StartUser)
    EndFunc   ;==>_TimerProc
    Func _GetSysTime(ByRef $sIdle, ByRef $sKernel, ByRef $sUser)
     DllCall("kernel32.dll", "int", "GetSystemTimes", "ptr", DllStructGetPtr($IDLETIME), _
       "ptr", DllStructGetPtr($KERNELTIME), _
       "ptr", DllStructGetPtr($USERTIME))
     $sIdle = DllStructGetData($IDLETIME, 1)
     $sKernel = DllStructGetData($KERNELTIME, 1)
     $sUser = DllStructGetData($USERTIME, 1)
    EndFunc   ;==>_GetSysTime
    Func _CPUCalc()
     Local $iSystemTime, $iTotal, $iCalcIdle, $iCalcKernel, $iCalcUser
     $iCalcIdle = ($EndIdle - $StartIdle)
     $iCalcKernel = ($EndKernel - $StartKernel)
     $iCalcUser = ($EndUser - $StartUser)
     $iSystemTime = ($iCalcKernel + $iCalcUser)
     $iTotal = Int(($iSystemTime - $iCalcIdle) * (100 / $iSystemTime))
     Local $CPU = $iTotal
     If $CPU & "%" <> GUICtrlRead($Label22) And ($CPU >= 0 And $CPU <= 100) Then
      GUICtrlSetData($Progress2, $CPU)
      GUICtrlSetData($Label22, $CPU & "%")
     EndIf
    EndFunc   ;==>_CPUCalc

下载地址:
http://u.115.com/file/f547c38d81

5201314 2013-04-19 17:59
了解学习一下了,感谢分享了


查看完整版本: [-- SystemInfo Test        By Fengwuji --] [-- top --]



Powered by PHPWind v7.3.2 Code © 2003-08 PHPWind
Time 0.026434 second(s),query:3 Gzip enabled

You can contact us