powered by simpleCommunicator - 2.0.36     © 2025 Programmizd 02
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / Icon in TrayBar
7 сообщений из 7, страница 1 из 1
Icon in TrayBar
    #32061601
ComeRun
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Kak ya mogu sdelat' "refresh TrayBar" iz VB?
Prichina: posle togo, kak posylaju:
Код: plaintext
PostMessage hW, WM_QUIT,  0 ,  0 

ikonka ostaetsya i uxodit, kogda podvozhu mouse...

Spasibo vsem!
...
Рейтинг: 0 / 0
Icon in TrayBar
    #32061608
Фотография NNN
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Перед выходом надо убивать иконку
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
  'Public constants, types & declares
  Public Const NIM_DELETE As Long = &H2
  Public NID As NOTIFYICONDATA
  ...

  'Remove the icon from the taskbar
  Call Shell_NotifyIcon(NIM_DELETE, NID)
...
Рейтинг: 0 / 0
Icon in TrayBar
    #32061622
ComeRun
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
U menya eta stroka stoit i v "Form_Terminate" i v "Form_Unload" !!! No delo v tom, chto ya "ubivaju" programmu iz drugoj! I pri vsem moem ogromnom zhelanii vysheukazannye events ne "poseshajutsya"!
...
Рейтинг: 0 / 0
Icon in TrayBar
    #32061652
Фотография NNN
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
A через Form_QueryUnload не пробовал?
...
Рейтинг: 0 / 0
Icon in TrayBar
    #32061745
ComeRun
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Teper' i eto poproboval... Ne idet... :-(
...
Рейтинг: 0 / 0
Icon in TrayBar
    #32061816
Фотография NNN
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Фигня какая-то у меня получается, через UpdateWindow и RedrawWindow, трей вроде как перерисовывается, но 'мертвый' значок висит. Может попробовать убивать приложение через закрытие его главного окна?
Код: plaintext
1.
PostMessage hW, WM_CLOSE,  0 ,  0 

Может в этом случае какое-нибудь событие сработает..
...
Рейтинг: 0 / 0
Icon in TrayBar
    #32063571
uchastik
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
'Declare a user-defined variable to pass to the Shell_NotifyIcon
'function.
Private 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

'Declare the constants for the API function. These constants can be
'found in the header file Shellapi.h.

'The following constants are the messages sent to the
'Shell_NotifyIcon function to add, modify, or delete an icon from the
'taskbar status area.
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2

'The following constant is the message sent when a mouse event occurs
'within the rectangular boundaries of the icon in the taskbar status
'area.
Private Const WM_MOUSEMOVE = &H200

'The following constants are the flags that indicate the valid
'members of the NOTIFYICONDATA data type.
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4

'The following constants are used to determine the mouse input on the
'the icon in the taskbar status area.

'Left-click constants.
Private Const WM_LBUTTONDBLCLK = &H203 'Double-click
Private Const WM_LBUTTONDOWN = &H201 'Button down
Private Const WM_LBUTTONUP = &H202 'Button up

'Right-click constants.
Private Const WM_RBUTTONDBLCLK = &H206 'Double-click
Private Const WM_RBUTTONDOWN = &H204 'Button down
Private Const WM_RBUTTONUP = &H205 'Button up

'Declare the API function call.
Private Declare Function Shell_NotifyIcon Lib "shell32" _
Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean

'Dimension a variable as the user-defined data type.
Dim nid As NOTIFYICONDATA

Private Sub Command1_Click()
'Click this button to add an icon to the taskbar status area.

'Set the individual values of the NOTIFYICONDATA data type.
nid.cbSize = Len(nid)
nid.hWnd = Form1.hWnd
nid.uId = vbNull
nid.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
nid.uCallBackMessage = WM_MOUSEMOVE
nid.hIcon = Form1.Icon
nid.szTip = "Taskbar Status Area Sample Program" & vbNullChar

'Call the Shell_NotifyIcon function to add the icon to the taskbar
'status area.
Shell_NotifyIcon NIM_ADD, nid
End Sub

Private Sub Command2_Click()
'Click this button to delete the added icon from the taskbar
'status area by calling the Shell_NotifyIcon function.
Shell_NotifyIcon NIM_DELETE, nid
End Sub

Private Sub Form_Load()
'Set the captions of the command button when the form loads.
Command1.Caption = "Add an Icon"
Command2.Caption = "Delete Icon"
End Sub

Private Sub Form_Terminate()
'Delete the added icon from the taskbar status area when the
'program ends.
Shell_NotifyIcon NIM_DELETE, nid
End Sub

Private Sub Form_MouseMove _
(Button As Integer, _
Shift As Integer, _
X As Single, _
Y As Single)
'Event occurs when the mouse pointer is within the rectangular
'boundaries of the icon in the taskbar status area.
Dim msg As Long
Dim sFilter As String
msg = X / Screen.TwipsPerPixelX
Select Case msg
Case WM_LBUTTONDOWN
Case WM_LBUTTONUP
Case WM_LBUTTONDBLCLK
CommonDialog1.DialogTitle = "Select an Icon"
sFilter = "Icon Files (*.ico)|*.ico"
sFilter = sFilter & "|All Files (*.*)|*.*"
CommonDialog1.Filter = sFilter
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
Form1.Icon = LoadPicture(CommonDialog1.FileName)
nid.hIcon = Form1.Icon
Shell_NotifyIcon NIM_MODIFY, nid
End If
Case WM_RBUTTONDOWN
Dim ToolTipString As String
ToolTipString = InputBox("Enter the new ToolTip:", _
"Change ToolTip")
If ToolTipString <> "" Then
nid.szTip = ToolTipString & vbNullChar
Shell_NotifyIcon NIM_MODIFY, nid
End If
Case WM_RBUTTONUP
Case WM_RBUTTONDBLCLK
End Select
End Sub
...
Рейтинг: 0 / 0
7 сообщений из 7, страница 1 из 1
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / Icon in TrayBar
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]