Change the icon text on the desktop to transparent

Source: Internet
Author: User
Transparent Option Explicit

Private Type Pointapi
X as Long
Y as Long
End Type

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 updatewindow Lib "user32" (ByVal hwnd as long) 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 sendmessagep Lib "user32" Alias "SendMessageA" (ByVal _
hwnd as long, ByVal wmsg as Long, ByVal WParam as Long, lParam as any) _
As Long

Private Declare Function getsyscolor Lib "user32" (ByVal nindex as long) as long
Private Declare Function setsyscolors Lib "user32" (ByVal nchanges as Long, _
Lpsyscolor as Long, lpcolorvalues as long) as long

Const Lvm_first = &h1000
Const Lvm_getitemcount = Lvm_first + 4
Const Lvm_settextcolor = Lvm_first + 36
Const Lvm_redrawitems = Lvm_first + 21
Const Lvm_settextbkcolor = Lvm_first + 38
Const lvm_setitemposition = Lvm_first + 15

Const color_desktop = 1

' Restorecolor function back to default icon text color and background
Sub Restorecolor ()
Dim Lcolor as Long

Lcolor = GetSysColor (color_desktop)
SetSysColors 1, Color_desktop, lcolor
End Sub
Sub Seticontext (Clfore, clback as Long, Btrans as Boolean)
Dim Hwindow as Long
Dim Litemcount as Long

' Search through three steps to the window where you put your desktop chart
Hwindow = FindWindow ("ProgMan", "program Manager")
Hwindow = FindWindowEx (Hwindow, 0, "Shelldll_defview", "")
Hwindow = FindWindowEx (Hwindow, 0, "SysListView32", "")

If Btrans Then ' Transparent background
SendMessage Hwindow, Lvm_settextbkcolor, 0, &HFFFFFFFF
Else ' non-transparent background
SendMessage Hwindow, Lvm_settextbkcolor, 0, Clback
End If

' Set the color of the icon text
SendMessage Hwindow, Lvm_settextcolor, 0, Clfore

' Redraw all the icons
Litemcount = SendMessage (Hwindow, lvm_getitemcount, 0, 0)
SendMessage Hwindow, Lvm_redrawitems, 0, LItemCount-1
' Update window
UpdateWindow Hwindow
End Sub

Sub Arrangedesktopicon (iwidth As Integer, iheight as Integer)
Dim Hwindow as Long
Dim I1, I2, I, icount as Integer
Dim Po as Pointapi

' Search through three steps to the window where you put your desktop chart
Hwindow = FindWindow ("ProgMan", "program Manager")
Hwindow = FindWindowEx (Hwindow, 0, "Shelldll_defview", "")
Hwindow = FindWindowEx (Hwindow, 0, "SysListView32", "")

I1 = 20:i2 = 20
icount = SendMessage (Hwindow, lvm_getitemcount, 0, 0)
For i = 0 to ICount-1
po.x = I1:PO.Y = I2
' Send lvm_setitemposition message Arrange Icons
Call SendMessage (Hwindow, Lvm_setitemposition, I, I2 * 65536 + i1)
I1 = I1 + iwidth
If i1 > ((SCREEN.WIDTH/15)--) Then
I1 = 20
I2 = I2 + iheight
End If
Next I
SendMessage Hwindow, Lvm_redrawitems, 0, ICount-1
' Update window
UpdateWindow Hwindow
End Sub

Private Sub Command1_Click ()
' Sets the color of the icon text to be blue, the background color is black, and the backdrop is transparent
Seticontext vbblue, Vbblack, True
End Sub

Private Sub Command2_Click ()
Restorecolor
End Sub

Private Sub Command3_Click ()
' Arrange icons in 100x100 pixels
Arrangedesktopicon 100, 100
End Sub

Private Sub Form_Load ()
Command1.Caption = "Set text Background"
Command2.Caption = "Restore text Background"
command3.caption = "Arrange desktop icons"
End Sub
Run the program, click Command1, you can see the desktop icon of the text color into the blue, if you set the desktop picture, you can also see the text
The background becomes transparent instead of having an unsightly color block underneath, click Command2 to restore Windows default settings, click Command3 to
Make your desktop icons flow horizontally, but only if you want to set the auto arrange properties of the desktop icons to false.
The above program runs under vb6,windows98,windows2000.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.