The icon text on the desktop is changed to transparent

xiaoxiao2021-03-06  47

Option expedition

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_Adval 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_SETITETEMPSITION = LVM_FIRST 15

Const color_desktop = 1

'Restorecolor function Reply The 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

'Find the window to place the desktop chart through three steps

Hwindow = FindWindow ("Progman", "Program Manager") hwindow = findwindowex (hwindow, 0, "shelldll_defview", "")

HWindow = FindWindowEx (Hwindow, 0, "SyslistView32", "")

IF BTRANS TEN 'transparent background

SendMessage Hwindow, LVM_SETTEXTBKCOLOR, 0, & HFFFFFFFFF

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 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) (IWIDT AS Integer)

DIM HWINDOW AS Long

DIM I1, I2, I, ICOUNT AS INTEGER

Dim Po as pointapi

'Find the window to place the desktop chart through three steps

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: para.y = i2

'Send LVM_SETITEMPSITION message arrangement icon

Call sendMessage (Hwindow, LVM_SETITETETEMPSITION, I, I2 * 65536 I1)

I1 = i1 iWidth

IF i1> (Screen.width / 15) - 32) THEN

I1 = 20

I2 = i2 Iheight

END IF

Next I

SendMessage Hwindow, LVM_RedrawItems, 0, ICOUNT - 1

'Update window

UpdateWindow Hwindow

End Sub

Private submmand1_click ()

'Set the color of the icon text for blue, background color is black, background is transparent

SeticonText Vbblue, Vbblack, True

End Sub

Private sub fascist2_click ()

Restorecolor

End Sub

Private submmand3_click ()

'Arranged in units of 100x100 pixels

ArrangeDesktopicon 100, 100nd Sub

Private sub flow_load ()

Command1.caption = "Sets text background"

Command2.caption = "Restore text background"

Command3.caption = "Arrange Desktop Icon"

End Sub

Run the program, click Command1, you can see the text scene of the desktop icon becomes blue, if you set a desktop picture, you can also see the text

The background has become transparent instead of a grunge color block, click Command2 to restore Windows default settings, click Command3

Allow your desktop icon to arrange in the manner, but the premise is to set the automatic arrangement of the desktop icon to false.

The above programs run in VB6, Windows98, and Windows2000.

转载请注明原文地址:https://www.9cbs.com/read-80366.html

New Post(0)