是否有任何选项可以更改Excel任务栏中的Excel图标?
答案 0 :(得分:1)
免责声明:我通常不回答OP没有做出任何努力的问题,但这太有趣了,无法传递。但如果这个问题被关闭,不要感到惊讶:)
是否可以选择更改Excel任务栏中的Excel图标
是的。您必须为此
使用3个API ExtractIcon32
,GetActiveWindow32
和SendMessage32
要了解它们,请参阅THIS LINK。这是我最喜欢的一站API:)
Declare Function ExtractIcon32 Lib "shell32.dll" Alias _
"ExtractIconA" (ByVal hInst As Long, _
ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
Declare Function GetActiveWindow32 Lib "user32" _
Alias "GetActiveWindow" () As Integer
Declare Function SendMessage32 Lib "user32" Alias _
"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Sub Sample()
Dim myIcoFile As String
Dim NewIco
'~~> Change this to the relevant icon file
myIcoFile = "D:\Temp\icons\CHARACT\$SIGN1.ico"
NewIco = ExtractIcon32(0, myIcoFile, 0)
SendMessage32 GetActiveWindow32(), &H80, 1, NewIco
End Sub