Results 1 to 15 of 15

Thread: Refresh the taskbar/systray?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    8

    Question

    I have written an app that runs in the systray of windows to manage the app suite i have created. The problem is, when i close the app (by having vb send an End statement), the icon for the app still appears until i move my mouse over the systray. Is there a way i can remove the icon before closing down the app so it is gone right away? I don't want to confuse my customers too much.


  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    First, don't use end, it might not unload everything in your app, eating up memory and resources.

    Then, are you using an activeX that works with the system tray or do you have your own code to do it?
    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

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    8

    Method

    I'm using an end statment that then lets the queryunload procedure run. This unloads the form i enacpsulated the systray icon stuff in and then sets the variable to nothing. In the queryunload procedure of the form that has the icon stuff, i run the Shell_notifyIcon function with NIM_DELETE as the flag. This runs fine, it just doesn't refresh the desktop/systray after doing it. What i need is to somehow tell the systray to refresh so the icon disappears.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Put a break in the querry unload and see if it stops there, or else you should unload the form with unload command
    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.

  5. #5
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    This works fine at my machine:
    Shell_NotifyIcon NIM_DELETE, nid

    I wouldn't use the end statement. If the problem persists, you could try sending a WM_PAINT message to the systray.

    Sorry I couldn't be of much help.

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    8
    I guess that's my ultimate question. How do i send a WM_PAINT message to the systray?

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    My tray app, have no wm_paints in it, and it works fine. Do you want the source?
    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.

  8. #8

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    8
    Sure, i'll give anything a shot.

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  10. #10
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I have to correct myselve. Although sending a WM_PAINT message would refresh the systray, this should not be necesary if the icon was deleted successfully. If the icon was not deleted successfully refreshing the systray would only delete the icon, if the app that placed it there was not running anymore, so this would not help.

    The only thing I can think about is that you might have declared the nid local to a procedure. When deleting the icon, you would send an empty NOTIFYICONDATA structure, and the delete would fail. If this is the case, declare the variable at module level (Private or Public as appropriate).

    I know this is far fetched, but it is (next to the End statement) the only thing I can think about.

  11. #11
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Lightbulb

    Try my code at

    http://vbcity.com/vbcode/en/click.asp?id=42

    it's working perfectly. Don't forget to place the DeleteIcon() into Form_Unload() method.

    Regards

  12. #12

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    8
    Well i tried to look at kedaman's code, but i get a file not found error. Then when i try to go to his site, i'm greeted with the notification that a virus is being installed on my PC. Thanks. I also tried smalig's site, but my DNS server can't find vbcity.com anywhere.

  13. #13
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Question

    What file is missing? Any error messages?

    Don't worry about the virus, my homepages do that to everyone that visits it.
    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.

  14. #14

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    8
    What i mean is that when i try to follow your URL link, is says Error 404 File not found. Is it possible you didn't make it readable to the world(everyone)?

  15. #15
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well, my page is totally reincarnated:
    http://www.geocities.com/kedasu
    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.

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