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

📄 form1.frm

📁 本文件包含200个visual baisc实例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form form1 
   Caption         =   "用列表显示系统正在运行的程序(包括隐含的)"
   ClientHeight    =   5220
   ClientLeft      =   4470
   ClientTop       =   2715
   ClientWidth     =   6225
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5220
   ScaleWidth      =   6225
   Begin VB.CommandButton Command1 
      Caption         =   "退出"
      Height          =   390
      Left            =   75
      TabIndex        =   1
      Top             =   4785
      Width           =   6060
   End
   Begin VB.ListBox list1 
      Height          =   4200
      ItemData        =   "Form1.frx":000C
      Left            =   90
      List            =   "Form1.frx":0013
      Sorted          =   -1  'True
      TabIndex        =   0
      Top             =   495
      Width           =   6030
   End
   Begin VB.Label Label1 
      Caption         =   "程序列表"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   465
      Left            =   75
      TabIndex        =   2
      Top             =   60
      Width           =   6075
   End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Declare Function GetDesktopWindow Lib "user32" () As Long

Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long

Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, _
    ByVal lpString As String, ByVal cch As Long) As Long
    
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _
    ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
    ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const HWND_TOPMOST = -1
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2

Private Sub Form_Load()
  SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
  
  Dim lngDeskTopHandle As Long
  Dim lngHand As Long
  Dim strName As String * 255
  Dim lngWindowCount As Long

  lngDeskTopHandle = GetDesktopWindow()
  lngHand = GetWindow(lngDeskTopHandle, GW_CHILD)
  lngWindowCount = 1
  Do While lngHand <> 0
     GetWindowText lngHand, strName, Len(strName)
     lngHand = GetWindow(lngHand, GW_HWNDNEXT)
     If Left$(strName, 1) <> vbNullChar Then
        Me.list1.AddItem Left$(strName, InStr(1, strName, vbNullChar))
        lngWindowCount = lngWindowCount + 1
     End If
  Loop
  Label1.Caption = "程序列表共有:" & lngWindowCount & "个运行程序 "
End Sub

Private Sub Command1_Click()
  End
End Sub

⌨️ 快捷键说明

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