Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Who can share BCBDEV offline? 2

Status
Not open for further replies.

imagenetics

Programmer
Dec 8, 2003
66
PL
Damn! I didn't know that BCBDEV is going offline and now I need to check the FAQ about applications in the system tray. If you happen to have offline version of this website or this particular FAQ (with source, please), can you share it?
 
I have tried that program but i can't get the Icon into the taskbar. It reserves a place for it, i can doubleclick the empty space and thus bring my form back to visible and such but the icon doesn't show.

In the resources there are an icon (16 x 16, 16 col) named "LITTLEICON" but to no avail.

What am i doing wrong?

Totte
Keep making it perfect and it will end up broken.
 
By the way, i have BCBDEV FAQ in a ZIP-file

Totte
Keep making it perfect and it will end up broken.
 
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.
 
Thanks.

The problem is however somewhat different i guess.

I have made the icon in 16 x 16, 16 col with the resource editor, named it "LITTLEICON" and so forth. It's located in the project's resource file.

When i do the initial load of that icon i tested to put a timer and at the timer event set the forms icon to this "LITTLEICON" as loaded into the Graphics::TIcon.

It changes after 1 second to the right icon and us thus located and loaded.

But but but, i will nevertheless give it a go tomorrow and will report back about the result.

Totte
Keep making it perfect and it will end up broken.
 
The "IconData.hIcon = LoadIcon(HInstance, "LITTLEICON");" did it!

I did beforehand edit the standard .RC file in the project to contain the wanted icon and it works like a charm.

Thx.

By the way: i made the exact same change i RemoveIcon.

Totte
Keep making it perfect and it will end up broken.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top