VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 1665
ClientLeft = 2160
ClientTop = 1650
ClientWidth = 2940
Icon = "TBIcon.frx":0000
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 1665
ScaleWidth = 2940
ShowInTaskbar = 0 'False
Begin VB.PictureBox Picture1
Height = 495
Left = 120
ScaleHeight = 435
ScaleWidth = 435
TabIndex = 0
Top = 1680
Visible = 0 'False
Width = 495
End
Begin VB.Menu xx
Caption = "PopupMenu"
Visible = 0 'False
Begin VB.Menu mnu_hide
Caption = "隐藏"
End
Begin VB.Menu mnu_show
Caption = "显示"
End
Begin VB.Menu mnu_answer
Caption = "回复消息"
End
Begin VB.Menu mnu_space
Caption = "-"
End
Begin VB.Menu Menu
Caption = "退出"
Index = 0
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
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
Dim t As NOTIFYICONDATA
Private Sub Form_Load()
t.cbSize = Len(t)
t.hWnd = Picture1.hWnd
t.uId = 1&
t.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
t.ucallbackMessage = WM_MOUSEMOVE
t.hIcon = Form1.Icon
t.szTip = "消息服务器" & Chr$(0)
Shell_NotifyIcon NIM_ADD, t
App.TaskVisible = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
t.cbSize = Len(t)
t.hWnd = Picture1.hWnd
t.uId = 1&
Shell_NotifyIcon NIM_DELETE, t
End Sub
Private Sub Menu_Click(Index As Integer)
Unload Me
End Sub
Private Sub mnu_hide_Click()
Me.Hide
End Sub
Private Sub mnu_show_Click()
Me.Show
End Sub
Private Sub picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Hex(X) = "1E3C" Then
Me.PopupMenu xx
End If
End Sub