I've seen some people complain about this in the newsgroups and it actually hit me the other day. I was able to trace it down to the root cause (at least for my case). Here goes.
When you build your project with the "Build with runtime packages" option enabled, the linker will place all packages' resources into your executable. The problem in my case was that bcbsmp40 was getting linked in.
Why would bcbsmp40 cause a problem? This has to do with how Borland C++ Builder chooses its application icon. It stores the icon
in the executable under the name "MAINICON." bcbsmp40 has the Delphi icon in its resource table by the same name. Oddly enough,
BCB's linker appears to copy the resources from packages into the executable after the ones from your executable, thereby
overriding the icon you specified in
So how did I find this problem? I created a new project, and started adding components to the form until the main icon broke. I built and ran the project between each component. When I started using the sample components, the icon broke. I then checked to see which package these are in, which of course is bcbsmp40.
I was a little -ahem- perturbed that this package would be so rude, so I uninstalled it from my component pallette. However, it still managed to break my application. I ended up having to edit the makefile for that application to remove all references to it.
This was not the end of the story however. I loaded another project, and it too was broken. I removed all references to bcbsmp40, and it was still broken. It turned out that it was using a package which depended on bcbsmp40, so bcbsmp40 was still getting linked in. At this point I had had enough of bcbsmp40, so I went and deleted %bcb%\bin\bcbsmp40.bpl and %bcb%\lib\bcbsmp40.*. A quick recompile of my package and the project that used it, and things were back to working in no time.
Should you delete your bcbsmp40? I believe you should, without hesitation. The source is available in %bcb%\Examples\Controls. Don't build the package from there, however, because that one will have the Delphi icon in it. Instead, make a copy of the controls you want to use and build them separately. I'm not sure which control specifically caused the problem. Maybe I'll get bored enough to investigate this more fully, but don't hold your breath. For now, I advise you don't use the sample components at all.