I'm not sure what code you are using. But does the program know you are clicking the right mouse button?
Code:Public Const WM_LBUTTONDOWN = &H201 Public Const WM_LBUTTONUP = &H202 Public Const WM_LBUTTONDBLCLICK = &H203 Public Const WM_RBUTTONUP = &H205 Public Const WM_MOUSEMOVE = &H200 Private Sub Form_MouseMove(button As Integer, Shift As Integer, X As Single, Y As Single) Static lngMsg As Long Static blnFlag As Boolean Dim result As Long lngMsg = X / Screen.TwipsPerPixelX If blnFlag = False Then blnFlag = True Select Case lngMsg 'right-click Case WM_RBUTTONUP result = SetForegroundWindow(Me.hwnd) If vbNo = MsgBox("Do you really want to shutdown the program?" & vbCrLf & "Click Yes to quit.", vbYesNo + vbExclamation + vbDefaultButton2 + vbMsgBoxSetForeground) Then Cancel = True Exit Sub Else Cancel = False Call DeleteSystrayIcon(picSystray) Unload Me End End If Case WM_LBUTTONUP result = SetForegroundWindow(Me.hwnd) PopupMenu Me.mnumenu End Select blnFlag = False End If End Sub




Reply With Quote