-
Another Hicup
right i can get my program to minimise to the systray, but when i click on the icon the popup menu doens't appear so that i can restore the program
i need to add this line to the click event of the icon, but all the icon is, is a picture box called PicIcon,
here is the code that i need to add somewhere
Code:
frmmain.PopupMenu mnuPop
please help
for more information check this link out
http://www.vbforums.com/showthread.p...threadid=88188
thanks for your help regarding this matter
-
You need to change a couple of things:
1: You created a function called CreatetrayIcon, which has a parameter for the Handle of the object in the systems tray. You set it as Me.hWnd, where it should be the handle of the picture box, thus:
Code:
Private Sub lblm_Click()
'MsgBox ("This will minimise the program to the systray") ' this will minimise the program to the systray
CreateTrayIcon PicIcon.hWnd, PicIcon.Picture, "Alarm"
Me.Hide
End Sub
2: Unfortunatley my proxy can't get me back to your original thread, so i can't see the original code, but I think you need to add this event to your form too:
Code:
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Const WM_MBUTTONDBLCLK = &H209
Private Const WM_MBUTTONDOWN = &H207
Private Const WM_MBUTTONUP = &H208
Private Const WM_RBUTTONDBLCLK = &H206
Private Const WM_RBUTTONDOWN = &H204
Private Const WM_RBUTTONUP = &H205
Private Const SW_SHOWNORMAL = 1
Private Sub picicon_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Msg = X / Screen.TwipsPerPixelX
If Msg = WM_RBUTTONUP Then 'Right click
Me.PopupMenu mnuPop
End If
End Sub
Let me know how you get on...
-
That is similar to what Mark gave me earlier, and it does work now,
Thanks for the help
:)