永发信息网

VB程序隐藏进托盘问题

答案:1  悬赏:60  手机版
解决时间 2021-06-06 16:11
  • 提问者网友:树红树绿
  • 2021-06-06 12:42

怎么我的程序加载了皮肤控件后,隐藏进系统托盘就无法弹起来了!下面是代码

Option Explicit

'-------------------------------------------------------------------------------------系统托盘
Const MAX_TOOLTIP As Integer = 64
Const NIF_ICON = &H2
Const NIF_MESSAGE = &H1
Const NIF_TIP = &H4
Const NIM_ADD = &H0
Const NIM_DELETE = &H2
Const WM_MOUSEMOVE = &H200
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const WM_LBUTTONDBLCLK = &H203
Const WM_RBUTTONDOWN = &H204
Const WM_RBUTTONUP = &H205
Const WM_RBUTTONDBLCLK = &H206
Const SW_RESTORE = 9
Const SW_HIDE = 0
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 Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Private nfIconData As NOTIFYICONDATA
'-------------------------------------------------------------------------------------

Private Sub Command1_Click()
nfIconData.hWnd = Me.hWnd
nfIconData.uID = Me.Icon
nfIconData.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
nfIconData.uCallbackMessage = WM_MOUSEMOVE
nfIconData.hIcon = Me.Icon.Handle
nfIconData.szTip = "System" & vbNullChar
nfIconData.cbSize = Len(nfIconData)
Call Shell_NotifyIcon(NIM_ADD, nfIconData)
ShowWindow Me.hWnd, SW_HIDE
End Sub

Private Sub Form_Load()

'-------------------------------------------------------------------------------------加载背景
Me.KSSkiner1.Path = App.Path & "\kss\XP.kss"
Me.KSSkiner1.RePaint Me
'-------------------------------------------------------------------------------------
End Sub

'=====================================================================================系统托盘
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lMsg As Single
lMsg = X / Screen.TwipsPerPixelX
If lMsg = WM_RBUTTONUP Or lMsg = WM_LBUTTONUP Then
Call Shell_NotifyIcon(NIM_DELETE, nfIconData) '退出图标
Me.Show
End If
End Sub
'=====================================================================================
能最小化到托盘,但是点击托盘图标窗体显示不出来了

Me.KSSkiner1.Path = App.Path & "\kss\XP.kss"
Me.KSSkiner1.RePaint Me

是我加载的一个窗体控件!去掉这个控件就能弹出了!怎么回事?

各路大罗神仙帮帮忙!谢谢~~

最佳答案
  • 五星知识达人网友:轻熟杀无赦
  • 2021-06-06 12:48

控件是否兼容你的方法。另外重新显示窗体时是否需要重新加载控件。

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯