Results 1 to 9 of 9

Thread: System Tray Problems

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Posts
    19

    System Tray Problems

    Hi all,

    I'm having problems with putting my program in the system tray and all. I'm using the code from http://www.vb-world.net/api/tip61.html

    When the system tray icon is clicked, I want my form to pop up. My problem is that instead of popping up, it just blinks and flashes in the taskbar...

    Anyone had this problem and solved it? Thnx in advance.

  2. #2
    Banned Michael_Kamen's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    1,180
    What is the code you use in the MouseMove event to popup your form?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Posts
    19
    Code:
    X = X / Screen.TwipsPerPixelX
    Select Case X
    Case WM_LBUTTONDOWN
    Caption = "Left Click"
    Case WM_RBUTTONDOWN
    Caption = "Right Click"
    Case WM_MOUSEMOVE
    Caption = "Move"
    Case WM_LBUTTONDBLCLK
    Me.Show
    Me.SetFocus
    Caption = "Double Click"
    End Select

  4. #4
    Banned Michael_Kamen's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    1,180
    Perhaps this works:
    VB Code:
    1. Me.Show
    2. Me.WindowState = vbNormal
    3. Me.Setfocus

  5. #5
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Talking New vbForums styleeeeeee!

    Have a look at this project...not finished yet, but it'll do the trick...
    System tray code. Allows you to add image lists and the ability to use animation in the system tray
    Oh, and it doesn't piggy back off the MouseMove event either, full subclassing...

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Posts
    19
    Thanks Wokawidget, that was exactly what I was looking for

  7. #7
    Lively Member
    Join Date
    Mar 2001
    Location
    Norway
    Posts
    88
    What's the problem with "piggy backing" off the MouseMove event really? I've been using that solution for a while now and still haven't run into any problems. Will I run into problems with it in the future or is it safe enough to use?
    - zen

  8. #8
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Talking G b...Lalalala...Woof...More drugs please? NO!

    Errr...I used to piggy back of the MouseMove event, but then some VB experts here, can't remember who, although I think it was users like Hack etc, said that SubClassing was the way to do it correctly, which makes sense since what happens if you need to use the MouseMove event, for a mousemove command???

    Think that's what they told me...can anyone else enlighten us?

    Oh, with the project above, DO NOT terminate your app with the END statement, and do not use the STOP button in VB's IDE, always close the app properly or VB with die on it's arse
    Forgot to mention that...Not bad programming, just that while it's subclassed it's best if you unsubclass and close the app correctly...

    Woka

  9. #9
    Lively Member
    Join Date
    Mar 2001
    Location
    Norway
    Posts
    88
    Well, I'm not gonna use the mousemove event for anything else, so it should be ok then I guess

    I'll try to use subclassing in my next project, but for now I guess this will do just nicely.
    - zen

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