Tasktray Popup menu 
Author Message
 Tasktray Popup menu

HI all,
My tasktray popup menu will not go away when i click elsewhere on the
screen or taskbar, given that i decided not to click one of the menu
items (the app represented by the tasktray icon is not visible at this
stage).  All other tasktray icon menus disappear when clicking
elsewhere... how can i get my popup menu to follow this principle (i'm
using form1.PopUpMenu menutitle... )


Sun, 11 Dec 2005 19:15:20 GMT  
 Tasktray Popup menu

Quote:
> My tasktray popup menu will not go away when i click elsewhere on the
> screen or taskbar, given that i decided not to click one of the menu
> items (the app represented by the tasktray icon is not visible at this
> stage).  All other tasktray icon menus disappear when clicking
> elsewhere... how can i get my popup menu to follow this principle (i'm
> using form1.PopUpMenu menutitle... )

So far so good, look at this:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single,
y As Single)
On Error Resume Next

    Const WM_NULL = &H0
    Dim r As Long

    r = x / Screen.TwipsPerPixelX
    If r = 513 Then 'Klick &H203 Then 'Doppelklick auf TrayIcon
        If Me.Visible Then
            Me.WindowState = vbMinimized
        Else
            WinPowerOffVordergrund True, False
        End If
    End If
    'If r <> 512 Then Debug.Print r
    If r = &H205 Then
        Me.TimerMain.Enabled = False
        apiSetForegroundWindow Me.hwnd
        PopupMenu mnuSymbol
        If Not ProgrammBeenden Then 'If not Exit
            PostMessage Me.hwnd, WM_NULL, 0, 0  '<----- close PopUp
            Me.TimerMain.Enabled = True
        End If
    End If

End Sub



Sun, 11 Dec 2005 21:30:22 GMT  
 Tasktray Popup menu
Thanks Gunter,

I didn't quite get what you were going on about but i have learnt all
that is required is to
SetForegroundWindow Form1.hwnd
What a simple answer, a one-liner fixed my problem. I noticed you had
that in your code as well ( i just had to read between the lines)

Thanks.



Mon, 12 Dec 2005 12:24:50 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Popup menus on form called from a popup menu

2. show a shortcut menu / popup menu / context menu

3. HELP : Popup menu doesn't popup ??

4. Need Help: Trouble adding a custom menu pick to a custom popup menu in VBA

5. Context Menus coming up first with Popup Menus

6. add new menu options on a popup menu

7. URGENT! Start-menu style popup menu

8. Windows 95 System Menu and PopUp Menus PROBLEM

9. Using MDI Menus with child menu when child are hidden for popup

10. Right Click PopUp Menu and dynamic menu Item

11. Using MDI Menus with child menu when child are hidden for popup

12. Right Click PopUp Menu and dynamic menu Item

 

 
Powered by phpBB® Forum Software