delphi - System Tray Icon not appearing on startup -
I use the following code in the FormCreate event handler to create a system tray icon. When I run my program, the system tray icon looks fine.
I set my application to start automatically on windows. When I restart the computer, my application begins to process, but the system tray icon never appears
I think the code can be anything like the time it runs, Perhaps the system tray is not ready to populate.
It can be initialized through the NSIS installer: WriteRegStr HKLM "Software \ Microsoft \ Windows \ CurrentVersion \ Run" "MyApp" "$ INSTDIR \ MyApp.exe"
Code to create system tray icon:
Start cbSize with tray idoddata: = SizeOf (TrayIconData); Wnd: = Handle; UID: = 0; UFlags: NIF_MESSAGE + NIF_ICON + NIF_TIP; UCallbackMessage: = WM_ICONTRAY; HIcon: = Application.Icon.Handle; Strip copy (SGTP, app title); End; Shell_Notification (NIM_ADD, @TrayIconData);
Before you start the explorer, you are trying to create an icon (Scroll down "Handling Shell_NotifyIcon Failure").
You should also handle it - it enables you to recreate your mouse after the explorer crash and resume.
Comments
Post a Comment