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
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Private Declare Function DrawIconEx Lib "user32" (ByVal hdc As Long, ByVal xLeft As Long, ByVal yTop As Long, ByVal hIcon As Long, ByVal cxWidth As Long, ByVal cyWidth As Long, ByVal istepIfAniCur As Long, ByVal hbrFlickerFreeDraw As Long, ByVal diFlags As Long) As Long
Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal dwImageType As Long, ByVal dwDesiredWidth As Long, ByVal dwDesiredHeight As Long, ByVal dwFlags As Long) As Long
Private Declare Function DestroyIcon Lib "user32" (ByVal hIcon As Long) As Long
Private IconData As NOTIFYICONDATA
Private WithEvents pbPictureHook As PictureBox
Private sToolTip As String
Public Event LButtonDblClk()
Public Event LButtonDown()
Public Event LButtonUp()
Public Event RButtonDblClk()
Public Event RButtonDown()
Public Event RButtonUp()
Private frmSourceWindow As Form
Private bDefaultDblClk As Boolean
Private iCurrentFrame As Integer
Public Property Let ToolTip(ByVal sData As String)
ChangeToolTip sData
End Property
Public Property Get ToolTip() As String
ToolTip = sToolTip
End Property
Public Property Let DefaultDblClk(ByVal bData As Boolean)
bDefaultDblClk = bData
End Property
Public Property Get DefaultDblClk() As Boolean
DefaultDblClk = bDefaultDblClk
End Property
Public Property Set SourceWindow(ByVal frmData As Form)
Set frmSourceWindow = frmData
SetPicHook
End Property
Public Property Get SourceWindow() As Form
End Sub
Private Sub pbPictureHook_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Static rec As Boolean
Dim msg As Long
Dim oldmsg As Long
oldmsg = msg
msg = x / Screen.TwipsPerPixelX
If rec = False Then
rec = True
Select Case msg
Case WM_LBUTTONDBLCLK:
LButtonDblClk
Case WM_LBUTTONDOWN:
RaiseEvent LButtonDown
Case WM_LBUTTONUP:
RaiseEvent LButtonUp
Case WM_RBUTTONDBLCLK:
RaiseEvent RButtonDblClk
Case WM_RBUTTONDOWN:
RaiseEvent RButtonDown
Case WM_RBUTTONUP:
RaiseEvent RButtonUp
End Select
rec = False
End If
End Sub
Private Sub LButtonDblClk()
If bDefaultDblClk Then
frmSourceWindow.WindowState = vbNormal
frmSourceWindow.Show
App.TaskVisible = True
RemoveFromSysTray
End If