Results 1 to 3 of 3

Thread: Another Hicup

  1. #1

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604

    Another Hicup

    right i can get my program to minimise to the systray, but when i click on the icon the popup menu doens't appear so that i can restore the program

    i need to add this line to the click event of the icon, but all the icon is, is a picture box called PicIcon,

    here is the code that i need to add somewhere

    Code:
    frmmain.PopupMenu mnuPop
    please help

    for more information check this link out

    http://www.vbforums.com/showthread.p...threadid=88188

    thanks for your help regarding this matter

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  2. #2
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    You need to change a couple of things:

    1: You created a function called CreatetrayIcon, which has a parameter for the Handle of the object in the systems tray. You set it as Me.hWnd, where it should be the handle of the picture box, thus:

    Code:
    Private Sub lblm_Click()
    'MsgBox ("This will minimise the program to the systray") ' this will minimise the program to the systray
    CreateTrayIcon PicIcon.hWnd, PicIcon.Picture, "Alarm"
        Me.Hide
    End Sub
    2: Unfortunatley my proxy can't get me back to your original thread, so i can't see the original code, but I think you need to add this event to your form too:

    Code:
    Private Const WM_LBUTTONDBLCLK = &H203
    Private Const WM_LBUTTONDOWN = &H201
    Private Const WM_LBUTTONUP = &H202
    Private Const WM_MBUTTONDBLCLK = &H209
    Private Const WM_MBUTTONDOWN = &H207
    Private Const WM_MBUTTONUP = &H208
    Private Const WM_RBUTTONDBLCLK = &H206
    Private Const WM_RBUTTONDOWN = &H204
    Private Const WM_RBUTTONUP = &H205
    Private Const SW_SHOWNORMAL = 1
    
    Private Sub picicon_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Msg = X / Screen.TwipsPerPixelX
    
        If Msg = WM_RBUTTONUP Then  'Right click
            Me.PopupMenu mnuPop
        End If
    End Sub
    Let me know how you get on...

  3. #3

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604
    That is similar to what Mark gave me earlier, and it does work now,

    Thanks for the help


    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

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