Board logo

标题: [基础] 请教VB如何得到CPU,内存,系统运行时间 [打印本页]

作者: oaz    时间: 2008-2-27 16:57     标题: 请教VB如何得到CPU,内存,系统运行时间

如题,刚学VB,看到一个小软件有这样功能,请高手赐教
作者: Nothing    时间: 2008-2-27 23:28

关于CPU可以参考下现这个文章

http://www.lihuasoft.net/article/show.php?id=746
作者: Nothing    时间: 2008-2-27 23:32

Private Declare Function timeGetTime Lib "winmm.dll" () As Long

这个函数是返回系统运行时间的
作者: oaz    时间: 2008-2-28 01:01

谢谢管理员,网上找到一个系统运行时间
Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long

Private Sub Form_Load()
Dim aaa As Long
aaa = GetTickCount
Dim d As Date
d = TimeSerial(0, 0, aaa / 1000)
Label1.Caption = "Windows已经运行了" & d

For i = 0 To 3
    Line1(i).Visible = False
Next

MyMenu = GetSystemMenu(Me.hwnd, 0)
RemoveMenu MyMenu, &HF060, MF_BYCOMMAND

End Sub



Private Sub Label2_Click()
End
End Sub

Private Sub Timer1_Timer()
Dim aaa As Long
aaa = GetTickCount
Dim d As Date
d = TimeSerial(0, 0, aaa / 1000)
Label1.Caption = "Windows已经运行了" & d
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    For i = 0 To 3
        Line1(i).Visible = False
    Next
End Sub
Private Sub Label2_MouseDown _
(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Line1(0).BorderColor = &H80000010
        Line1(1).BorderColor = &H80000010
        Line1(2).BorderColor = &HE0E0E0
        Line1(3).BorderColor = &HE0E0E0
    End If
End Sub


Private Sub label2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Line1(0).BorderColor = &HE0E0E0
    Line1(1).BorderColor = &HE0E0E0
    Line1(2).BorderColor = &H80000010
    Line1(3).BorderColor = &H80000010
    For i = 0 To 3
        Line1(i).Visible = True
    Next
End Sub




欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/) Powered by Discuz! 6.0.0