Jump to content

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


Recommended Posts

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.

 

 

 

Edited by Mu0n
Link to post
Share on other sites
  • 68kMLA Supporter

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.

 

Edited by Crutch
Link to post
Share on other sites

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!

 

 

Edited by Mu0n
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...