Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Shell_NotifyIcon sometimes fails at startup

Shell_NotifyIcon sometimes fails at startup

Scheduled Pinned Locked Moved C / C++ / MFC
helplinux
3 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LukeV
    wrote on last edited by
    #1

    Hi! My application is automatically started when Windows is lauching. Sometimes Shell_NotifyIcon will fail. I do not have an error code since I haven't been to reproduce that bug very often. My guess is that the desktop is not ready or something. Do you think that it would be safe to do something like: BOOL bRes; do { bRes = Shell_NotifyIcon(...); }while(bRes = FALSE); Thanks!

    B R 2 Replies Last reply
    0
    • L LukeV

      Hi! My application is automatically started when Windows is lauching. Sometimes Shell_NotifyIcon will fail. I do not have an error code since I haven't been to reproduce that bug very often. My guess is that the desktop is not ready or something. Do you think that it would be safe to do something like: BOOL bRes; do { bRes = Shell_NotifyIcon(...); }while(bRes = FALSE); Thanks!

      B Offline
      B Offline
      BlackDice
      wrote on last edited by
      #2

      I can't remember it exactly (it's in my BugReporter article here on CP), but there's a way you can register a message to notify you when the taskbar gets repainted so that you can put the icon back in the system tray. Otherwise, when explorer.exe crashed and restarted, my icon would be gone from the system tray. I don't know if that helps any, but I tried. :) My articles www.stillwaterexpress.com BlackDice

      1 Reply Last reply
      0
      • L LukeV

        Hi! My application is automatically started when Windows is lauching. Sometimes Shell_NotifyIcon will fail. I do not have an error code since I haven't been to reproduce that bug very often. My guess is that the desktop is not ready or something. Do you think that it would be safe to do something like: BOOL bRes; do { bRes = Shell_NotifyIcon(...); }while(bRes = FALSE); Thanks!

        R Offline
        R Offline
        Ryan Binns
        wrote on last edited by
        #3

        LukeV wrote: Do you think that it would be safe to do something like: No. If there's an error with your input you'll have yourself a nice little infinite loop. I had this happen to me last night, although it happened for all programs. It turned out I had a virus, so I did a system restore and it's all good now :). I doubt that's your problem though. I've never had any problems with applications I've written doing this. I've heard of a few programs that add a few seconds delay during their startup to give Windows time to initialise properly. That might cure the problem. Other than that, there's not much you can do other than verifying that your input is correct.

        Ryan

        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups