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

📄 frmmain.frm

📁 功能界面漂亮的带宽使用量监视器
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      BackStyle       =   0  'Transparent
      Caption         =   "KB"
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   3840
      TabIndex        =   10
      Top             =   840
      Width           =   255
   End
   Begin VB.Line Line9 
      X1              =   1200
      X2              =   1200
      Y1              =   840
      Y2              =   1320
   End
   Begin VB.Line Line8 
      X1              =   360
      X2              =   4200
      Y1              =   1080
      Y2              =   1080
   End
   Begin VB.Line Line7 
      X1              =   360
      X2              =   4200
      Y1              =   1320
      Y2              =   1320
   End
   Begin VB.Line Line5 
      X1              =   2400
      X2              =   4200
      Y1              =   840
      Y2              =   840
   End
   Begin VB.Line Line4 
      X1              =   2400
      X2              =   2400
      Y1              =   600
      Y2              =   840
   End
   Begin VB.Line Line3 
      X1              =   360
      X2              =   2640
      Y1              =   840
      Y2              =   840
   End
   Begin VB.Line Line2 
      X1              =   360
      X2              =   2400
      Y1              =   600
      Y2              =   600
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "Received"
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   360
      TabIndex        =   9
      Top             =   1080
      Width           =   855
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "Sent"
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   405
      TabIndex        =   8
      Top             =   840
      Width           =   855
   End
   Begin VB.Label lblType 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   360
      TabIndex        =   7
      Top             =   600
      Width           =   1980
   End
   Begin VB.Label lblSent 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   1200
      TabIndex        =   6
      Top             =   840
      Width           =   2655
   End
   Begin VB.Label lblRecv 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   1200
      TabIndex        =   5
      Top             =   1080
      Width           =   2655
   End
   Begin VB.Label Label7 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Estimated Download Speed"
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   360
      TabIndex        =   4
      Top             =   1440
      Width           =   2415
   End
   Begin VB.Label Label8 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Estimated Upload Speed"
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   360
      TabIndex        =   3
      Top             =   1800
      Width           =   2415
   End
   Begin VB.Label Label9 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "0 KB"
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   2880
      TabIndex        =   2
      Top             =   1440
      Width           =   1335
   End
   Begin VB.Label Label10 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "0 KB"
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   2880
      TabIndex        =   1
      Top             =   1800
      Width           =   1335
   End
   Begin VB.Label lblCaption 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "CS Bandwidth Monitor v1.0.0"
      ForeColor       =   &H00000000&
      Height          =   225
      Left            =   120
      TabIndex        =   0
      Tag             =   "TitleColor"
      Top             =   120
      Width           =   2385
   End
   Begin VB.Image imgClose 
      Height          =   315
      Left            =   4200
      Picture         =   "FrmMain.frx":10F70
      Tag             =   "Close"
      ToolTipText     =   "Close"
      Top             =   45
      Width           =   315
   End
   Begin VB.Image imgMinimize 
      Height          =   300
      Left            =   3840
      Picture         =   "FrmMain.frx":11492
      Tag             =   "Minimize"
      ToolTipText     =   "Minimize"
      Top             =   45
      Width           =   315
   End
   Begin VB.Label Label11 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "About"
      ForeColor       =   &H00000000&
      Height          =   225
      Left            =   720
      TabIndex        =   14
      Tag             =   "TitleColor"
      Top             =   2325
      Width           =   1485
   End
   Begin VB.Image Image3 
      Height          =   330
      Left            =   720
      Picture         =   "FrmMain.frx":119AB
      ToolTipText     =   "Settings"
      Top             =   2280
      Width           =   1425
   End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'For Dragging Borderless Forms...
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function SetWindowRgn Lib "User32" (ByVal hwnd As Long, ByVal hrgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function ReleaseCapture Lib "User32" () As Long


Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean

Private Type NOTIFYICONDATA
    cbSize As Long
    mhWnd As Long
    uId As Long
    uFlags As Long
    ucallbackMessage As Long
    hIcon As Long
    szTip As String * 64
End Type

Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const WM_MOUSEMOVE = &H200
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4

Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Const WM_RBUTTONDBLCLK = &H206
Private Const WM_RBUTTONDOWN = &H204
Private Const WM_RBUTTONUP = &H205

Dim TheForm As NOTIFYICONDATA

Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Private m_objIpHelper As CIpHelper
Private TransferRate                    As Single
Private TransferRate2                   As Single


Private Sub Form_Activate()
   If MainOnTop = True Then
    'set this form always on top
    SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
   End If
   If MainOnTop = False Then
    'set this form not always on top
    SetWindowPos Me.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
   End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
'If UnloadMode = 0 Then
Cancel = True
'End If
Me.Hide
Unload FrmStats
End Sub

Private Sub Image2_Click()
FrmSettings.Show
End Sub

Private Sub Image3_Click()
frmAbout.Show
End Sub

Private Sub Label11_Click()
frmAbout.Show
End Sub

Private Sub Label12_Click()
FrmSettings.Show
End Sub

Private Sub Pic1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static Rec As Boolean, Msg As Long
    Msg = X / Screen.TwipsPerPixelX
    If Rec = False Then
        Rec = True
        Select Case Msg
            Case WM_LBUTTONDBLCLK:
                FrmMain.Show
            Case WM_LBUTTONDOWN:

            Case WM_LBUTTONUP:
                
            Case WM_RBUTTONDBLCLK:
                'PopupMenu mnufile
            Case WM_RBUTTONDOWN:
                
            Case WM_RBUTTONUP:
                PopupMenu FrmMenu.MenuFile
        End Select
        Rec = False
    End If
End Sub

Private Sub Timer1_Timer()

On Error Resume Next
Call UpdateInterfaceInfo

End Sub
Private Sub UpdateInterfaceInfo()

On Error Resume Next
Dim objInterface        As CInterface
Static st_objInterface  As CInterface
Static lngBytesRecv     As Double
Static lngBytesSent     As Double
Dim blnIsRecv           As Boolean
Dim blnIsSent           As Boolean
If st_objInterface Is Nothing Then Set st_objInterface = New CInterface
Set objInterface = m_objIpHelper.Interfaces(1)
Select Case objInterface.InterfaceType
Case MIB_IF_TYPE_ETHERNET: lblType.Caption = "Ethernet"
Case MIB_IF_TYPE_FDDI: lblType.Caption = "FDDI"
Case MIB_IF_TYPE_LOOPBACK: lblType.Caption = "Loopback"
Case MIB_IF_TYPE_OTHER: lblType.Caption = "Other"
Case MIB_IF_TYPE_PPP: lblType.Caption = "PPP"
Case MIB_IF_TYPE_SLIP: lblType.Caption = "SLIP"
Case MIB_IF_TYPE_TOKENRING: lblType.Caption = "TokenRing"
End Select
lblRecv.Caption = Trim(Format(m_objIpHelper.BytesReceived / 1024, "###,###,###,###,##0"))
lblSent.Caption = Trim(Format(m_objIpHelper.BytesSent / 1024, "###,###,###,###,##0"))
Set st_objInterface = objInterface
'---------------
blnIsRecv = (m_objIpHelper.BytesReceived / 1024 > lngBytesRecv / 1024)
blnIsSent = (m_objIpHelper.BytesSent / 1024 > lngBytesSent / 1024)

If IconToUse = "icon1" Then
If blnIsRecv And blnIsSent Then
Pic1.Picture = ImageList1.ListImages(4).Picture
Me.Icon = ImageList1.ListImages(4).Picture
Image1.Picture = ImageList1.ListImages(4).Picture
ElseIf (Not blnIsRecv) And blnIsSent Then
Pic1.Picture = ImageList1.ListImages(2).Picture
Me.Icon = ImageList1.ListImages(2).Picture
Image1.Picture = ImageList1.ListImages(2).Picture
ElseIf blnIsRecv And (Not blnIsSent) Then
Pic1.Picture = ImageList1.ListImages(3).Picture
Me.Icon = ImageList1.ListImages(3).Picture
Image1.Picture = ImageList1.ListImages(3).Picture
ElseIf Not (blnIsRecv And blnIsSent) Then
Pic1.Picture = ImageList1.ListImages(1).Picture
Me.Icon = ImageList1.ListImages(1).Picture
Image1.Picture = ImageList1.ListImages(1).Picture
End If
End If

If IconToUse = "icon2" Then
If blnIsRecv And blnIsSent Then
Pic1.Picture = ImageList2.ListImages(4).Picture
Me.Icon = ImageList2.ListImages(4).Picture
Image1.Picture = ImageList2.ListImages(4).Picture
ElseIf (Not blnIsRecv) And blnIsSent Then
Pic1.Picture = ImageList2.ListImages(2).Picture

⌨️ 快捷键说明

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