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

📄 frmmain.frm

📁 大量优秀的vb编程
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmMain 
   BorderStyle     =   3  'Fixed Dialog
   ClientHeight    =   1005
   ClientLeft      =   45
   ClientTop       =   45
   ClientWidth     =   3210
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1005
   ScaleWidth      =   3210
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.Timer Timer 
      Interval        =   100
      Left            =   120
      Top             =   480
   End
   Begin VB.Frame Frame1 
      Height          =   495
      Left            =   0
      TabIndex        =   0
      Top             =   -75
      Width           =   3135
      Begin VB.PictureBox pctPrg 
         Appearance      =   0  'Flat
         BackColor       =   &H00000000&
         BorderStyle     =   0  'None
         FillColor       =   &H00008000&
         ForeColor       =   &H0000FF00&
         Height          =   270
         Left            =   60
         ScaleHeight     =   18
         ScaleMode       =   3  'Pixel
         ScaleWidth      =   200
         TabIndex        =   1
         Top             =   150
         Width           =   3000
      End
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      Height          =   252
      Left            =   840
      TabIndex        =   2
      Top             =   600
      Width           =   1812
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


' The CPUUsage object
Private CPU As New CPUUsage
Private Avg As Long                         ' Average of CPU Usage
Private Sum As Long
Private Index As Long

Private Sub Form_Load()
    ' First, open the "StartStat" key
    CPU.InitCPUUsage
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Timer.Enabled = False
    Set CPU = Nothing
    Cancel = 0
End Sub

Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Call Form_MouseDown(Button, Shift, X, Y)
End Sub

Private Sub pctPrg_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 2 Then
        Unload Me
        End
    End If
    Call Form_MouseDown(Button, Shift, X, Y)
End Sub

Private Sub Timer_Timer()
    'Get the CPU Usage every second
    Dim tmp As Long
    tmp = CPU.GetCPUUsage
    Sum = Sum + tmp
    Index = Index + 1
    Avg = Int(Sum / Index)
    'Draw the bar
    pctPrg.Cls
    Label1.Caption = "CPU使用百分比" & tmp & "%"
    pctPrg.Line (0, 0)-(tmp, 18), , BF
    pctPrg.Line (Avg, 0)-(Avg, 18), &HFF
    pctPrg.Line (Avg + 1, 0)-(Avg + 1, 18), &HFF
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim rc As Long
    rc = ReleaseCapture
    rc = SendMessage(hwnd, WM_NCLBUTTONDOWN, LP_HT_CAPTION, ByVal 0&)
End Sub

⌨️ 快捷键说明

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