 |
JLRodgers Level: Moderator
 Registered: 04-04-2002 Posts: 1617
|
Re: How to Cancel menu (in systray) when app is lost forcus Archived to Disk
Offhand, although I've never messed with it, you could try:
1) Subclassing the form, trapping for when the mouse is away from the menu.
2) Set a timer event to start when the menu pops up, set to automatically hide after x seconds.
3) Put a "Close Menu" option on the pop up as an option, put at the top or bottom, separated so that it's noticed.
____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)
|
|
11-04-2002 at 03:46 PM |
|
|
JLRodgers Level: Moderator
 Registered: 04-04-2002 Posts: 1617
|
Re: How to Cancel menu (in systray) when app is lost forcus Archived to Disk
I'd have to look (possibly re-create) if someone else has code for it, feel free to do so.
It may take a few days, took me a while to get it to work last time.
|
|
12-04-2002 at 01:32 AM |
|
|
JLRodgers Level: Moderator
 Registered: 04-04-2002 Posts: 1617
|
Re: How to Cancel menu (in systray) when app is lost forcus Archived to Disk
Well, I looked, couldn't find the code.
Tried to recreate, it didn't work, or crashed, or brought the system to a virtual halt (would take mouse about ten seconds to move across the screen).
Unfortunetely I wasn't able to get a solution. Then I have WinXP, and even Microsoft's popup tray menus don't always close when you click off of them.
|
|
16-04-2002 at 05:27 AM |
|
|
Merrion Level: VB Guru
 Registered: 15-04-2002 Posts: 37
|
Re: How to Cancel menu (in systray) when app is lost forcus Archived to Disk
You can be notified when an application gains or loses the focus by subclassing that application's main form and trapping the WM_ACTIVATEAPP message.
I have written a subclassing wrapper dll (called EventVB.dll, downloadable from Merrion Computing Downloads that you could use to get this notification thus:
'\\ Form declarations
Option Explicit
Dim WithEvents vbLink As EventVB.ApiFunctions
Dim WithEvents vbWnd As EventVB.ApiWindow
Private Sub Form_Load()
Set vbLink = New EventVB.ApiFunctions
Set vbWnd = New EventVB.ApiWindow
vbWnd.hwnd = Me.hwnd
vbLink.SubclassedWindows.Add vbWnd
End Sub
|
This gives you a number of extra events for the form, one of which is ActiveApplicationChanged:
Private Sub vbWnd_ActiveApplicationChanged(ByVal ActivatingThisApp As Boolean, ByVal hThread As Long, Cancel As Boolean)
If Not ActivatingThisApp Then
'\\ Your app lost focus, so cancel the menu here....
End If
End Sub
|
HTH,
Duncan
____________________________
--8<------------------------------
Free components and source code - see http://www.merrioncomputing.com/Download/index.htm for details
|
|
16-04-2002 at 12:30 PM |
|
|
Merrion Level: VB Guru
 Registered: 15-04-2002 Posts: 37
|
Re: How to Cancel menu (in systray) when app is lost forcus Archived to Disk
quote: The EventVB.DLL should be saparated to be smaller catergory.
The source code is available for you to do so as your requirements dictate. It is not economic for us to maintain several overlapping codesets for this, however.
HTH,
Duncan
____________________________
--8<------------------------------
Free components and source code - see http://www.merrioncomputing.com/Download/index.htm for details
|
|
17-04-2002 at 09:26 AM |
|
|
|
|
 |
 |