1个回答
2013-12-28
展开全部
使用API函数,Shell_NotifyIcon
我以前写了个程序,代码贴了你看下把
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Private Type NOTIFYICONDATA
cbsize As Long
hwnd As Long
uid As Long
uflag As Long
ucallbackmessage As Long
hicon As Long
sztip As String * 64
End Type
Const ADD_ICON = 0
Const MODIFY_ICON = 1
Const DELETE_ICON = 2
Const ICON_MESSAGE = 1
Const ICON_ICON = 2
Const ICON_TIP = 4
Dim IconName As String
Dim m_intret As Integer
Dim m_icondata As NOTIFYICONDATA
Private Sub initiconstruct(hwnd As Long, theicon As Long, stip As String, _
icondata As NOTIFYICONDATA)
icondata.cbsize = Len(icondata)
icondata.hwnd = hwnd
icondata.uid = vbNull
icondata.uflag = ICON_MESSAGE Or ICON_ICON Or ICON_TIP
icondata.ucallbackmessage = vbNull
icondata.hicon = theicon
icondata.sztip = stip
End Sub
Private Sub Command1_Click()
Me.Icon = LoadPicture(IconName)
intret = Shell_NotifyIcon(DELETE_ICON, m_icondata)
initiconstruct Me.hwnd, Me.Icon, _
"这是(kikikaki)建立的系统托盘图标!" & vbNullChar, m_icondata
intret = Shell_NotifyIcon(ADD_ICON, m_icondata)
End Sub
Private Sub Command2_Click()
CmDig.Filter = "图标文件(*.ico)|*.ico"
CmDig.ShowOpen
If Not CmDig.FileName = "" Then
IconName = CmDig.FileName
Picture1.Picture = LoadPicture(IconName)
End If
End Sub
Private Sub Form_Load()
IconName = App.Path & "\1.ico"
Picture1.Picture = LoadPicture(IconName)
End Sub
Private Sub Form_Unload(Cancel As Integer)
intret = Shell_NotifyIcon(DELETE_ICON, m_icondata)
End Sub
我以前写了个程序,代码贴了你看下把
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Private Type NOTIFYICONDATA
cbsize As Long
hwnd As Long
uid As Long
uflag As Long
ucallbackmessage As Long
hicon As Long
sztip As String * 64
End Type
Const ADD_ICON = 0
Const MODIFY_ICON = 1
Const DELETE_ICON = 2
Const ICON_MESSAGE = 1
Const ICON_ICON = 2
Const ICON_TIP = 4
Dim IconName As String
Dim m_intret As Integer
Dim m_icondata As NOTIFYICONDATA
Private Sub initiconstruct(hwnd As Long, theicon As Long, stip As String, _
icondata As NOTIFYICONDATA)
icondata.cbsize = Len(icondata)
icondata.hwnd = hwnd
icondata.uid = vbNull
icondata.uflag = ICON_MESSAGE Or ICON_ICON Or ICON_TIP
icondata.ucallbackmessage = vbNull
icondata.hicon = theicon
icondata.sztip = stip
End Sub
Private Sub Command1_Click()
Me.Icon = LoadPicture(IconName)
intret = Shell_NotifyIcon(DELETE_ICON, m_icondata)
initiconstruct Me.hwnd, Me.Icon, _
"这是(kikikaki)建立的系统托盘图标!" & vbNullChar, m_icondata
intret = Shell_NotifyIcon(ADD_ICON, m_icondata)
End Sub
Private Sub Command2_Click()
CmDig.Filter = "图标文件(*.ico)|*.ico"
CmDig.ShowOpen
If Not CmDig.FileName = "" Then
IconName = CmDig.FileName
Picture1.Picture = LoadPicture(IconName)
End If
End Sub
Private Sub Form_Load()
IconName = App.Path & "\1.ico"
Picture1.Picture = LoadPicture(IconName)
End Sub
Private Sub Form_Unload(Cancel As Integer)
intret = Shell_NotifyIcon(DELETE_ICON, m_icondata)
End Sub
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询