Results 1 to 3 of 3

Thread: Should be very simple!

  1. #1

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727

    Lightbulb

    Hi,

    I'm runnung a vb project, a small icon sits on the system tray and when i click it a menu appears. To do so, i've a module and a code in the MouseDown event of the Form1 that goes:

    <code>
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

    If (X + Y ^ 16) = WM_RBUTTONDOWN Then
    Form1.PopupMenu mnuPopUp_0 'The menu
    End If
    End Sub
    </code>

    Everything works fine, BUT... when i click OUTSIDE the menu, the menu doesn't disappear...!!! I want that if i click on the taskbar, for example, the menu GOES AWAY!

    How can i do that? I tried a Form1.refresh but doesn't work as the taskbar is not SCALED in the form...

    HEEEEEEEEEEEEEEEEEEEEELPP!!

    W.
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  2. #2
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    HEy

    If you havent figured it out yet then I will send you my project later so you can have a look at mine..


    Matt

  3. #3

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    no i haven't figured it out, as apparently it is a windows bug... in c++ is easy: one must set the current window as the foreground window before calling TrackPopupMenu. This then causes a second problem - namely that the next time the menu is displayed it displays then immediately disappears. To fix this problem, you must make the currernt application active after the menu disappears. This can be done by sending a benign message such as WM_NULL to the current window.

    BUT HOW DO I DO THIS IN VB... that's the issue.
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width