Hey, Totte. The code from BCBDEV is 100% correct, it works flawlessly, even when you simply copy and paste it. Carefuly examine your code and copare it with the original and I'm sure you'll find an error.
As for the icon. "LITTLEICON" is a custom resource ID of the image that should be displayed as an icon in the tray. Meaning that you have to have a 16x16 pixels icon in the program's resources and the ID of this icon has to be "LITTLEICON".
To display an icon, however, you can skip the entire part with creating a TGraphics object. Go down to AddIcon() function and find a line
IconData.hIcon = TrayIcon->Handle;. Replace it with this:
Code:
IconData.hIcon = LoadIcon(HInstance, "LITTLEICON");
This will load the icon from resources as well, but without TGraphics.
How to add an icon to resources:
1. Open Notepad and write down the following:
Code:
LITTLEICON ICON "little_icon.ico"
2. Write down the Notepad file as "little_con.rc" in your project's directory.
3. Open the project, from the "Project" menu select "Add to project" (Shift+F11) find your "little_icon.rc" and add it.
As I said, icon's ID is custom depending of what you have in your resources.