Results 1 to 20 of 20

Thread: anyone with a spare minute

  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

    anyone with a spare minute

    hi

    anyone who is bored or has a spare minute can they please help me to work out why my program doesnt work, here all of the necessary files (except the wav files so on't try to play them as i haven't put in any error handlers ).

    what it is meant to do is when you click on the minimise button it should minimise to the systray, which it does, but when you click on it, it doesn't bring up the menu and i don't know why.

    Please help

    BTW the help files aren't inlcuded either

    cheers
    Attached Files Attached Files

    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

    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
    oh and anyone that helps can be added to the credits if they want

    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]

  3. #3
    chenko
    Guest
    Do you have PopupMenu Menuname in your click event for the task tray icon?

  4. #4

    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
    Yeah i do

    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]

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Sorry but I couldn't be bothered to fix your code
    paste all this into a form and add a picture box and a menu item called mnuBG and it works fine

    Code:
    Option Explicit
    
     Private Type NOTIFYICONDATA
        cbSize As Long
        hwnd As Long
        uID As Long
        uFlags As Long
        uCallbackMessage As Long
        hIcon As Long
        szTip As String * 64
      End Type
      Private Const NIM_DELETE = &H2
      Private Const NIM_MODIFY = &H1
      Private Const NIM_ADD = &H0
      Private Const NIF_ICON = &H2
      Private Const NIF_MESSAGE = &H1
      Private Const NIF_TIP = &H4
      Private Const GWL_WNDPROC = (-4)
      Private Const IDI_APPLICATION = 32512&
      Private Const WM_USER = &H400
      Private Const WM_COMMAND = &H111
    ''these are for the icon-in-system-tray
    Private Const NIF_DOALL = NIF_MESSAGE Or NIF_ICON Or NIF_TIP
    Private Const WM_MOUSEMOVE = &H200
    Private Const WM_LBUTTONDBLCLK = &H203
    Private Const WM_LBUTTONDOWN = &H201
    Private Const WM_RBUTTONDOWN = &H204
    Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
    
    Private Const VK_LBUTTON = &H1
    Private Const VK_RBUTTON = &H2
    
    
    Private Sub mnuBG_Click()
      
      'put an icon in the system tray andd hide the form
      CreateIcon
      Me.Hide
      
      
    End Sub
    Private Sub CreateIcon()
      Dim erg
      Dim Tic As NOTIFYICONDATA
      Tic.cbSize = Len(Tic)
      Tic.hwnd = Picture1.hwnd
      Tic.uID = 1&
      Tic.uFlags = NIF_DOALL
      Tic.uCallbackMessage = WM_MOUSEMOVE
      Tic.hIcon = Picture1.Picture
      'Tic.szTip = App.Title & Chr$(0)
      Tic.szTip = Me.Caption & Chr$(0)
      erg = Shell_NotifyIcon(NIM_ADD, Tic)
    End Sub
    
    Private Sub Command1_Click()
    
    End Sub
    
    Private Sub Form_Load()
     'picture1.picture becomes the system tray icon
      Picture1.Picture = Me.Icon
    End Sub
    Private Sub DeleteIcon()
      Dim erg
      Dim Tic As NOTIFYICONDATA
      Tic.cbSize = Len(Tic)
      Tic.hwnd = Picture1.hwnd
      Tic.uID = 1&
      erg = Shell_NotifyIcon(NIM_DELETE, Tic)
    End Sub
    
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
      x = x / Screen.TwipsPerPixelX
      Select Case x
        Case WM_LBUTTONDOWN
          'Caption = "Left Click"
          Me.Show
          DeleteIcon
        
          
          
        Case WM_RBUTTONDOWN
        
          'MsgBox "Right Click"
          'PopupMenu mnuPopup
          'mnuPopup.Visible = True
        Case WM_MOUSEMOVE
          'Caption = "Move"
        Case WM_LBUTTONDBLCLK
          'Caption = "Double Click"
          Me.Show
          DeleteIcon
        
          
      
          
        End Select
    End Sub
    Mark
    -------------------

  6. #6
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    this looks like a proper VB question to me NOT chit chat
    Mark
    -------------------

  7. #7

    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
    close but no cigar Mark,

    i need it when you click on a label to minimise and when you click on the icon on the systray it will bring up a menu of three options which are

    about
    Show program
    exit

    cheers anyways

    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]

  8. #8

    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
    Originally posted by Mark Sreeves
    this looks like a proper VB question to me NOT chit chat
    i realise that now, but i cannot move it

    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]

  9. #9
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    add PopupMenu mnuPopup to it....
    Code:
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
      x = x / Screen.TwipsPerPixelX
      Select Case x
        Case WM_LBUTTONDOWN
          'Caption = "Left Click"
          'Me.Show
          'DeleteIcon
        
          PopupMenu mnuPopup
          
        Case WM_RBUTTONDOWN
        
          'MsgBox "Right Click"
          PopupMenu mnuPopup
          'mnuPopup.Visible = True
          
          
        Case WM_MOUSEMOVE
          'Caption = "Move"
        Case WM_LBUTTONDBLCLK
          'Caption = "Double Click"
          'Me.Show
          'DeleteIcon
         PopupMenu mnuPopup
          
      
          
        End Select
    End Sub
    Mark
    -------------------

  10. #10

    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
    Originally posted by chenko
    Do you have PopupMenu Menuname in your click event for the task tray icon?
    i have just realised that there is no click event for the systray icon, well at least i don't think so all i have there is
    Code:
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If (X + Y ^ 16) - 1 = WM_RBUTTONDOWN Or (X + Y ^ 16) - 1 = WM_LBUTTONDOWN Then
           
           frmmain.PopupMenu mnuPop
           
           
        End If
    End Sub
    what should the click event for the icon be called, because all i am doing is getting an picture from a picture box and whacking it into the systray so where should i put the

    Code:
    frmmain.PopupMenu mnuPop
    bit ??????????

    cheers

    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]

  11. #11
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Did you try my code?
    Mark
    -------------------

  12. #12

    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
    i think i have worked out the fault, but i am not sure how to fix it

    i need to add the following line into the click event of the icon, but all i know about it, is that it is a picture box with an icon called PicIcon

    here is the line that i think that i need to add

    Code:
    frmmain.PopupMenu mnuPop
    please help, getting desperate now

    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]

  13. #13

    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
    Originally posted by Mark Sreeves
    Did you try my code?
    i did try your code thanks, but i can't implement it into my program as it will take too long

    thanks anyway

    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]

  14. #14
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    this works
    Last edited by Mark Sreeves; Jun 22nd, 2009 at 08:41 AM.
    Mark
    -------------------

  15. #15

    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
    You Star

    thanks what was the main problem with it or was it my poor programming

    you can be inlcuded in the credits if you want


    thanks once again

    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]

  16. #16
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I didn't look at your code.
    I just "plugged" my own stuff in and removed any conflicts....
    Mark
    -------------------

  17. #17

    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
    thanks

    BTW you are inlcuded in the credits now, the program will be available for download in a few hours, i will post a thread when the program is available

    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]

  18. #18
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    I think I identified your problem on the VB forums - you had a reference to the the handle of your form (Me.hWnd), where it should have been to the picturebox picIcon.hWnd. Also some event to identify a rightclick on the icon was needed.


    But cutting and psting is a lot quicker!!!

  19. #19
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    I did have a spare minute, but I ueds it up reading this thread and writting this post
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  20. #20

    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

    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