VB.net“尝试读取或写入受保护的内存。这通常指示其他内存已损坏。” 10

小白求教、本是VB的代码、改用VS2017、总是出错、不知道出里错了OptionExplicitOnModuleModule1PublicDeclareFunctionS... 小白求教、本是VB的代码、改用VS2017、总是出错、不知道出里错了
Option Explicit On
Module Module1
Public Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwmainssage As Int32, lpData As NOTIFYICONDATA) As Long
Public Const MAX_TOOLTIP As Integer = 64
Public Const NIF_ICON As Integer = &H2
Public Const NIF_mainSSAGE As Integer = &H1
Public Const NIF_TIP As Integer = &H4
Public Const NIM_ADD As Integer = &H0
Public Const NIM_DELETE As Integer = &H2
Public Const WM_MOUSEMOVE As Integer = &H200
Public Const WM_LBUTTONUP As Integer = &H202
Public Const WM_RBUTTONUP As Integer = &H205
Public Const MF_bitmap As Integer = &H4&
Public Const WM_LBUTTONDBLCLK As Long = &H203
Public Const MF_bitmap As Integer = &H4&

Public Structure NOTIFYICONDATA
Dim cbSize As Long
Dim hwnd As Long
Dim uID As Icon
Dim uFlags As Long
Dim uCallbackmainssage As Long
Dim hIcon As Long
Dim szTip As String '* MAX_TOOLTIP
End Structure
Public nfIconData As NOTIFYICONDATA
Public Sub Sys_Tray()
nfIconData.hwnd = Form1.Handle
nfIconData.uID = Form1.Icon
nfIconData.uFlags = NIF_ICON Or NIF_mainSSAGE Or NIF_TIP
nfIconData.uCallbackmainssage = WM_MOUSEMOVE
nfIconData.hIcon = Form1.Icon.Handle
nfIconData.szTip = "托盘提示" & vbNullChar
nfIconData.cbSize = Len(nfIconData)
Shell_NotifyIcon(NIM_ADD, nfIconData)
End Sub
End Module
展开
 我来答
tianqing20wen

2019-03-19 · TA获得超过2.4万个赞
知道大有可为答主
回答量:8226
采纳率:88%
帮助的人:5037万
展开全部

vb.net 有专门的托盘图标控件 在工具箱里直接添加一个就可以了 两行代码即可

 NotifyIcon1.Icon = Me.Icon
NotifyIcon1.Visible = True

先戏越睡车身1z
2019-03-19 · 超过94用户采纳过TA的回答
知道答主
回答量:660
采纳率:39%
帮助的人:151万
展开全部
(14)铸雪斋本该文附于《马介甫》之后;(15)青柯亭刻本改题“花神”;
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式