在托盘上显示BalloonTooltip

0 Reply , Posted in 程序代码 on 2017 28, 2017

////////////////////////////////////model.bas//////////////////////////////////////////////

Option Explicit
Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias _
     "Shell_NotifyIconA" (ByVal dwMessage As Long, _
     lpData As NOTIFYICONDATA) As Long

Public Type NOTIFYICONDATA
    cbSize As Long
    hwnd As Long
    uId As Long
    uFlags As Long
    uCallBackMessage As Long
    hIcon As Long
    szTip As String * 128
    dwState As Long
    dwStateMask As Long
    szInfo As String * 256
    uTimeoutOrVersion As Long   '由于VB中没有Union类型,只能用Long型代替
    szInfoTitle As String * 64
    dwInfoFlags As Long
End Type
 
Public Const NOTIFYICON_VERSION = 3
Public Const NOTIFYICON_OLDVERSION = 0

Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE = &H2

Public Const NIM_SETFOCUS = &H3
Public Const NIM_SETVERSION = &H4
 
Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4

Public Const NIF_STATE = &H8
Public Const NIF_INFO = &H10
 
Public Const NIS_HIDDEN = &H1
Public Const NIS_SHAREDICON = &H2
 

Public Const NIIF_NONE = &H0
Public Const NIIF_WARNING = &H2
Public Const NIIF_ERROR = &H3
Public Const NIIF_INFO = &H1

Public nfIconData As NOTIFYICONDATA


//////////////////////////////form.frm////////////////////////////////

Option Explicit

Private Sub Form_Load()
    With nfIconData
        .cbSize = Len(nfIconData)
        .hwnd = Me.hwnd
        .uId = vbNull
        .uFlags = NIF_INFO Or NIF_ICON Or NIF_TIP Or NIF_MESSAGE
        .hIcon = Me.Icon
        .szTip = "你的小消息可以放在此..." & vbNullChar
        .dwState = 0
        .dwStateMask = 0
        .szInfo = "这是一个Balloon Style Tool-tip!又一个小技巧可以应用了       " & Chr(13) & ":)" & vbNullChar
        .uTimeoutOrVersion = 15000
        .szInfoTitle = "哈哈,看到了么" & vbNullChar
        .dwInfoFlags = NIIF_INFO
    End With

     Call Shell_NotifyIcon(NIM_ADD, nfIconData)
End Sub


Private Sub Form_Unload(Cancel As Integer)
Call Shell_NotifyIcon(NIM_DELETE, nfIconData)
End Sub

标签:  

相关推荐

vb读取access并且显示  (2017-5-11 9:18:27)

VB 获取CPU温度示例  (2017-5-8 10:35:11)

VB程序逆向反汇编常见的函数   (2017-5-8 10:32:0)

VB内嵌汇编的模块示例  (2017-5-8 10:24:4)

内存数据的读写(PC)   (2017-3-1 17:51:40)

用VB制作外挂   (2017-3-1 16:16:53)

发表评论:



◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

                       

  鄂公网安备 42112502000156号     鄂ICP备16019550号