Print Page | Close Window

Menu in System Tray

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=7079
Printed Date: 18 June 2025 at 5:24pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Menu in System Tray
Posted By: Majek
Subject: Menu in System Tray
Date Posted: 08 May 2007 at 9:40am
Hi, I'm using CommandBars to display a popup menu in the system tray when the user right-clicks a NotifyIcon. Everything works great except when the menu is open, and you click somewhere on the screen the menu doesn't go away when it loses focus. Is there an event that is raised when the popup menu loses focus? I want to hide the popup menu when the user clicks somewhere on the screen so it acts as a normal tray menu. I'm using VB 2005 and CommandBars 10.1.



Replies:
Posted By: jpbro
Date Posted: 14 May 2007 at 2:27pm
Hi Majek,

    I ran into this problem on my SysTray project that wasn't using CodeJock controls, so I believe it is a VB problem. My solution is to call the SetForegroundWindow API immediately before showing the popup menu:


In your declarations:

    Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long

Then in your sub:

    SetForegroundWindow Me.hwnd
    PopupMenu Me.mnuPopup




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net