Results 1 to 9 of 9

Thread: Tray Icon

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Tray Icon

    My application creates tray icon but when I close my application that icon still remains in system tray until I move mouse cursor close to that icon.
    Is there any way so that the sys tray icon gets removed after my application close.

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Tray Icon

    Do you have the code to delete the icon from there in Form unload or Query Unload event? If so, this happends just when running from VB IDE and stoping execution from VB IDE because it forces the Form to close whithout processing that events. Close the Form from your app and this shouldn't happen, this is how it will always work when the app is compiled.

  3. #3
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Tray Icon

    just see this attachment...
    Attached Files Attached Files
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  4. #4
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: Tray Icon

    What kind of tray icon are you using? Third party OCX?

    Your program might be crashing when it closes (i.e. not closing properly). I notice that if my vb app crashes, the icon will stay there until i mouse over it. Double check that it's not crashing.

    I use DevPower Tray Icon. It's free and it's super easy to use (it includes balloon tips as well)! http://www.devpower.com/trayicon/home.aspx
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  5. #5
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    Jar, Norway
    Posts
    372

    Re: Tray Icon

    If you don't put:
    VB Code:
    1. t.cbSize = Len(t)
    2.     t.hWnd = Me.hWnd
    3.     t.uId = 1&
    4.     Shell_NotifyIcon &H2, t
    5.     Me.Refresh
    in the Form_QueryUnload the icon stays till you turn off your computer. And where
    this is in module:
    VB Code:
    1. Private Type NOTIFYICONDATA
    2.     cbSize As Long
    3.     hWnd As Long
    4.     uId As Long
    5.     uFlags As Long
    6.     ucallbackMessage As Long
    7.     hIcon As Long
    8.     szTip As String * 64
    9. End Type
    10. Dim t As NOTIFYICONDATA
    11. Private Declare Function Shell_NotifyIcon Lib "shell32" Alias _
    12.       "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
    Morten

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Re: Tray Icon

    thanks for reply

    "in the Form_QueryUnload the icon stays till you turn off your computer. And where
    this is in module"

    now i am getting new problem i am not able write code in form unload or terminate these events are not seems to be working . don't know why..

  7. #7
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    Jar, Norway
    Posts
    372

    Re: Tray Icon

    Quote Originally Posted by xor83
    thanks for reply

    "in the Form_QueryUnload. Otherwise the icon stays till you turn off your computer. And where
    this is in module"

    now i am getting new problem i am not able write code in form unload or terminate these events are not seems to be working . don't know why..
    Never heared of. Not able to write? Or app passing without trigging what is written?

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Re: Tray Icon

    that's write events not trigging

    My application is an addon and sometimes when main application crashes my application tray menu still remains.
    Last edited by xor83; Dec 11th, 2006 at 11:44 PM.

  9. #9
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    Jar, Norway
    Posts
    372

    Re: Tray Icon

    Is this the exe of you application. Then you have a problem. I remember when the app (attached) was only running in debug mode. I had to move the mousepointer over the TrayIcon to make it disappear.

    The DaysWork is made to make you able to show how much time you're logged on (on monthly base). All data is stored in registry to remain private. But has to be empty through printing out or deleted. It has an extra routine to remember 'NumLock' was on or off (Windows 2k did not?). That's why KEYSTA32.OCX is a part.

    The exe from this has never let me stay with an icon in tray after ending.
    Pick what you want!
    Attached Files Attached Files

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