永发信息网

VB无标题栏的窗体,运行时如何在任务栏显示图标?

答案:2  悬赏:60  手机版
解决时间 2021-02-14 17:40
  • 提问者网友:两耳就是菩提
  • 2021-02-14 00:34
本人做了一个无标题栏的VB窗体, 请问,在运行时如何在任务栏显示它的图标啊?有满意的回答者,将高分回报!
最佳答案
  • 五星知识达人网友:胯下狙击手
  • 2021-02-14 02:14
'任务栏图标,其它的呢自己修改Option Explicit
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Const MAX_TOOLTIP As Integer = 64
Const NIF_ICON = &H2
Const NIF_MESSAGE = &H1
Const NIF_TIP = &H4
Const WM_MOUSEMOVE = &H200
Const NIM_ADD = &H0
Private Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String * MAX_TOOLTIP
End Type
Private Sub Form_Load()
Dim nfIconData As NOTIFYICONDATA
With nfIconData
.hWnd = Me.hWnd
.uID = Me.Icon
.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
.uCallbackMessage = WM_MOUSEMOVE
.hIcon = Me.Icon.Handle
'定义鼠标移动到托盘上时显示的Tip
.szTip = App.Title & vbNullChar '+ "(版本 " & App.Major - 1 & "." & App.Minor & "." & App.Revision & ")" & vbNullChar
.cbSize = Len(nfIconData)
End With
Call Shell_NotifyIcon(NIM_ADD, nfIconData)
End Sub
全部回答
  • 1楼网友:洒脱疯子
  • 2021-02-14 02:57
r
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯