form1.frm
来自「收集的100多个适合不同层次VB爱好者编程的实例源码」· FRM 代码 · 共 50 行
FRM
50 行
VERSION 5.00
Begin VB.Form Form1
Caption = "将桌面图标文字背景设置为透明色"
ClientHeight = 3075
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3075
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "执 行"
Height = 495
Left = 1800
TabIndex = 0
Top = 1080
Width = 1335
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 FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function InvalidateRect Lib "user32" (ByVal hwnd As Long, ByVal lpRect As Long, ByVal bErase As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LVM_SETTEXTBKCOLOR = &H1000 + 38
Private Sub ShowError()
MsgBox "未知的错误", vbOKOnly + vbInformation
End
End Sub
Private Sub Command1_Click()
Dim Parent&, Child&, CChild&
Parent = FindWindow(vbNullString, "Program Manager")
If Parent = 0 Then ShowError
Child = FindWindowEx(Parent, 0, "SHELLDLL_DefView", vbNullString)
If Child = 0 Then ShowError
CChild = FindWindowEx(Child, 0, "SysListView32", vbNullString)
If CChild = 0 Then ShowError
SendMessage CChild, LVM_SETTEXTBKCOLOR, 0, ByVal &HFFFFFFFF
InvalidateRect CChild, 0, True
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?