Results 1 to 4 of 4

Thread: System Tray Icons

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Antrim
    Posts
    80

    Question

    Hi,

    I'm building an application which places an icon in the system tray.

    In the Form Unload(Cancel As Integer) event I am calling the function to remove the icon:

    Cancel = True
    sysMain.RemoveFromTray
    Unload Me

    This works fine until the application is ended by another means i.e. through Task Manager or by the SCADA system the application is being developed to compliment.

    Is there somewhere I can call my RemoveFromTray procedure from in order to remove the icon from the tray when the application is ended rather than when the form is unloaded.

    Any suggestions would be greatly appreciated.

    Best regards,

    Rob Brown.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Should be removed unless you have loops that exceeds 20 seconds without any doevents to check for WM_CLOSE's At least if you are using a control or object, loaded on the form. If your app is terminated, it won't have a chance to unload anything, i'm sure no system intends to try that first.

    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362
    umm...

    a couple of thoughts.

    if it's your form thats dying without apparently doing it's thing, try and place the code in the _queryUnload event, as opposed to the UnloadEvent.

    Also, you could try incapsulating your app in an App class, this way you may be able to catch the Terminate event there.

    You will always have a problem doing this at the easiest level. The prob is that TaskMananger kills in to kinds of ways. One politely, and if it gets no joy that way, it'll do it with 'extreme prejudice'. You could maybe set up a little something to catch just these windows messages (like an hidden form) that catch, make your call, pass the message on. Might be possible...



    td.
    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    tumblingdown@hotmail.com

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Antrim
    Posts
    80
    Thanks for the suggestions,

    I don't have any lengthy loops in my code so that's not the problem. The entire app cycles on a timer with a one second interval.

    The problem here is that Task Manager is using Kill or Destroy or some other such nice function and I'm pretty sure the SCADA system will be acting in the same way. I don't speak C++ so I can't be sure.

    What is an App Class. I haven't come accross this before.

    Thanks,

    Rob Brown.

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