Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

system tray icon menu 1

Status
Not open for further replies.

Horrid

Programmer
Joined
May 20, 1999
Messages
373
I have made my system tray icon and have a pop up menu that does come up. I have used the mousemove event and check for a mouse click, this works sometimes but usually requires two clicks and my boss cant get it to work on his laptop at all.

My current code is

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
PopupMenu mnuTray
End If
End Sub

Can someone give me some pointers as to how to have the menu show on one mouse click consitantly. Don't need full code example just some helpfull pointers (note: if you post full code I wont complain :-) ).

Thanks in advance
 
and the solution to the problem is

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

DoEvents


Dim msg As Long
msg = X / Screen.TwipsPerPixelX

Select Case msg
Case WM_LBUTTONDOWN
PopupMenu mnuTray
Case WM_LBUTTONUP
PopupMenu mnuTray
Case WM_LBUTTONDBLCLK
PopupMenu mnuTray
Case WM_RBUTTONDOWN
PopupMenu mnuTray
Case WM_RBUTTONUP
PopupMenu mnuTray
Case WM_RBUTTONDBLCLK
PopupMenu mnuTray
End Select

End Sub

I found this code on the microsoft site but it didn't have the doevents in it, added it in frustration and bingo, away it goes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top