• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

How to link a default icon resource to your built app from Symantec C++ 6 (THINK C)

Mu0n

Well-known member
I'd like for my built C application to have a custom icon polled from a resource file during the building step.

I successfully did it some 15 years ago for a mock project I was doing, but I don't remember how I did it or what I'm missing. Here's what I'm using:

1) System 7.5.3 under Basilisk II

2) Symantec C++ 6.0 (THINK C Project Manager)

3) My project name doesn't end with .(pi symbol) because this particular configuration of emulator and my own Windows 7/10 installed keyboard languages doesn't allow for using option-P to produce that symbol. I used to do it under Basilisk JIT 152 but that version is very unstable and crashy to me, so I'm not using it because it's a lot of pain to constantly save, quit the emulator to make sure your virtual hard disk is properly updated and come back.

4) I made a resource file under ResEdit with the same name as my project file, but ending in .rsrc. I tried both making an ICON resource and an ICN# resource with resource ID 128. My old project seems to use the latter one. I haven't tried both at the same time.

If I try to add the .rsrc in the project files, it will complain about a duplicate icon resource during the Build Application step.

If I merely let the .rsrc file sit in the same folder as the project, it won't complain but then the built application still has the default app icon.

 
Last edited by a moderator:

Crutch

Well-known member
Finder icons indeed live in ICN# resources (not ICON, which are resources for display e.g. in dialog boxes).  You will also need a properly configured BNDL and FREF resource, and a signature resource (same resource type as your application creator code).  ResEdit sets up most of this for you if you open your resource file and hit Cmd-K to create a BNDL resource, then double-click in the blank row of icons to edit or paste in the icons you want to use.  When you’re done, you should have ICN#, BNDL, and FREF resources all with ID 128.  The Finder should now find your icon and add it to the Desktop file/desktop database (depending on system version).  If you do everything right and still don’t see your icon, rebuild the desktop file (hold Cmd-Option while loading the Finder).

For the signature resource, just create a resource with the same type as your application’s creator code, ID 128, then choose “Open Using Template”, and use the string template (‘STR ‘, note the space).  This allows you to edit it as a string. You can then put anything you want in there, it will show up in “Get Info” in (at least older versions of) the Finder, newer versions might replace this with the info in the ‘vers’ resource, I don’t recall offhand.  I am not sure if, strictly speaking, you need a signature resource for your icon to display properly, but it would be very unusual not to have one.

You also need your finished application’s “Bundle” bit to be set, which you can check with ResEdit, “File -> Get File/Folder Info”.  In practice this would always be done automatically by the compiler, so you shouldn’t have to worry about it.

From memory (I can check later), you don’t want to add the resource file to the project in THINK Project Manager and you don’t need the project name to end in π.  Just name the resource file “[whatever your project name is, with or without the π].rsrc” and it should be automatically included. 

p.s.  I have always thought this was one of the most weirdly overcomplicated processes ever designed.  I have never seen documentation that explains precisely what the point of an FREF resource is, or why the “local IDs” they contain are even necessary for any purpose.

 
Last edited by a moderator:

Mu0n

Well-known member
Things I had done after my post but before yours:

-Make a BNDL resource with ID=128

-Transfer what I had in ICON to ICN# with ID=128

-Link the ICN# to the BNDL

-Use a unique signature in the BNDL

-Use the same signature in the whole resource file info, 'Creator' field

-Check the 'Has Bundle' checkbox in the file info

What I hadn't done:

-make a 'STR ' resource

It still doesn't work. I'm trying to hold cmd-option down while I load basilisk, but it's having no effect. However, it's not clear which combination of left/right windows keys that are properly mapped to it so I'll keep trying. Also, I'll attempt to load it in System 6 inside mini-vMac

edit - welp, it worked in mini-vMac!

 
Last edited by a moderator:

ravuya

Active member
You can also trigger a desktop DB rebuild from TechTool and probably other tools like it. 

 
Hi, trying to set this up too, I am using Code Warrior but it seems like this is all ResEdit so thinking it should apply. Here is how I have it configured - the default generic app icon is gone but my icon still doesn't show up. It could be the BasiliskII option command not working of course, might try something like TechTool, but if anyone can verify this configuration...

I was not able to follow how to configure the `STR ` resource though, is it required just to get the icon?
Screenshot 2024-03-05 at 8.27.23 AM.png
 

Phipli

Well-known member
Hi, trying to set this up too, I am using Code Warrior but it seems like this is all ResEdit so thinking it should apply. Here is how I have it configured - the default generic app icon is gone but my icon still doesn't show up. It could be the BasiliskII option command not working of course, might try something like TechTool, but if anyone can verify this configuration...

I was not able to follow how to configure the `STR ` resource though, is it required just to get the icon?
View attachment 70735
It's slightly difficult to see in your post, but you may have some confusion with the file type and creator vs resource ID. "File Type" in FREF 128 should be a 4 letter string.

What is your application type and creator? The Info window you are showing is just for the resources file before build, not the application itself. See the attached images of an application open in ResEdit, and observe how the Type and Creator is shown in the Info window and used in the BNDL and FREF resources? The type of your Application is almost certainly APPL by definition, and Creator will be set in your project / development environment. Don't change the ones in the Info window you've shown above ("RSRC" and "RSED") - those are the resource file's settings, not your project's/Application's. That specific window is to do with the actual file you have open, not what it will be built into.

1000016773.jpg

1000016772.jpg

1000016771.jpg
 
Last edited:
Thanks! I definitely had things muddled and then some other stuff muddying things that my screenshot didn't show too from when I was messing around trying to get it to work.
 
Top