Поиск на сайте
Главная Журнал Форум Wiki DRKB Страны мира


Как добавить свою иконку в traybar(рядом с часиками)

 

Declare Function Shell_NotifyIconA Lib "SHELL32" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Integer
Public Const NIM_ADD = 0
Public Const NIM_MODIFY = 1
Public Const NIM_DELETE = 2
Public Const NIF_MESSAGE = 1
Public Const NIF_ICON = 2
Public Const NIF_TIP = 4

Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Public Function SetTrayIcon(Mode As Long, hWnd As Long, Icon As Long, tip As String) As Long
Dim nidTemp As NOTIFYICONDATA
nidTemp.cbSize = Len(nidTemp)
nidTemp.hWnd = hWnd
nidTemp.uID = 0&
nidTemp.uFlags = NIF_ICON Or NIF_TIP
nidTemp.uCallbackMessage = 0&
nidTemp.hIcon = Icon
nidTemp.szTip = tip & Chr$(0)
SetTrayIcon = Shell_NotifyIconA(Mode, nidTemp)
End Function

Использование:
' Добавить иконку формы в traybar
SetTrayIcon NIM_ADD, Me.hWnd, Me.Icon, "Test"
' Изменить иконку и tooltip
SetTrayIcon NIM_MODIFY, Me.hWnd, Me.Icon, "It works!"
' Удалить иконку из traybar'a
SetTrayIcon NIM_DELETE, Me.hWnd, 0&, ""

 

 


Основные разделы сайта


 

Реклама