Microsoft KB Archive/34351

= Mac QB 1.00 README: Creating Application and Document Icons =

Article ID: 34351

Article Last Modified on 11/21/2006



This article was previously published under Q34351



SUMMARY
The following is a replacement for the &quot;Creating Application Icons with ICN#&quot; discussion on Pages 152, 153, 154, 155, 156, and 157 of the &quot;Microsoft QuickBasic for Apple Macintosh: User's Guide.&quot; The discussion in the manual is incomplete and incorrect. This information was taken from the README file on the release disk.



Summary
The following resources (located in a compiled QuickBasic application) can be modified with ResEdit to give an application and its documents their own customized icons: BNDL; FREF; ICN#; and the sample &quot;signature&quot; resource, &quot;MBCB&quot;. The information in the Finder's Get Info dialog box for the application can also be specified.

Procedure
You can create a compiled program with its own icon, and it can create document files with their own icons. A document file can be assigned its own icon by changing its file and creator types to correspond to resource information stored in the compiled application. The icon for a given document file type is taken from the resource fork of the compiled application and stored in the Finder's Desktop file.

The default creator code is blank, and the default file type is &quot;TEXT&quot;, for files created with the OPEN statement. The creator and file types of a document must be changed by your QuickBasic program after the file is created.  Change the creator type of a document using the SetCreate MBLC library routine, as follows:

SetCreate docfile$,&quot;MYAP&quot;

 Change the file type using the NAME statement, as follows:

NAME docfile$ AS docfile$,&quot;MYFT&quot;



Double-clicking a document icon runs the associated application. By PEEKing through a handle to the application parameters, your application can determine which file was selected. See &quot;File Browser.source&quot; on the Examples disk for sample code that does this.

Here are step-by-step instructions for creating your own icons:  Compile a program using Microsoft QuickBasic. For this example, assume the compiled program is called &quot;MYPROGRAM apl&quot;. Run ResEdit. Double-click on the &quot;MYPROGRAM apl&quot; application. Select New from the File menu, then do the following:

 Type a unique creator resource type, for example: &quot;MYAP&quot;.</li> The following window appears: &quot;MYAP's from MYPROGRAM apl&quot;.</li> Select New from the File menu.</li> Close the new resource window.</li> Choose Get Info from the File menu and change the number that appears in the first &quot;ID:&quot; box to 0 (zero).</li> Close the window.</li> Perform the following steps if you wish to put a string in the file's Get Info box in the Finder:

 Select the new resource, and choose Open As from the File menu.</li> Select type &quot;STR &quot; (NOT &quot;STR#&quot;).</li> Type the text that you want to appear in a Get Info from the Finder.</li> Close windows. If you do not want text to appear in the Get Info window, then open the resource, and type three zeros.</li></ol> </li></ol> </li> Double-click on BNDL, then do the following:

 <li>Double-click on &quot;BNDL=128&quot;.</li> <li>Change OwnerName to be the same as the unique, four-character, application resource type used in Step 4a (&quot;MYAP&quot;).</li> <li>Close two windows.</li></ol> </li> <li>Perform this step if you want custom document icons:

<ol style="list-style-type: lower-alpha;"> <li>Double-click on FREF.</li> <li>Double-click on &quot;FREF=129&quot;.</li> <li>Change the &quot;File Type&quot; to &quot;MYFT&quot;. This is the type used in the NAME statement in the &quot;MYPROGRAM apl&quot; program.</li> <li>Close two windows. No other program will be able to open your documents. You do not need to change the file type if your application creates plain text files (type TEXT).</li></ol> </li> <li>Double-click on ICN#.

<ol style="list-style-type: lower-alpha;"> <li>Edit the application icon and, if desired, the document icon. Then select &quot;Data to Mask&quot; from the ICN# menu.</li> <li>Close three windows.</li> <li>Click YES to Save.</li></ol> </li> <li>While the &quot;MYPROGRAM apl&quot; application is highlighted, select Get Info from the File menu.

<ol style="list-style-type: lower-alpha;"> <li>Change the Creator to the unique four-character application creator resource name used in Step 4a (&quot;MYAP&quot;).</li> <li>Close the window.</li> <li>Click YES to Save.</li></ol> </li> <li>Rebuild the Macintosh Desktop in either of the following ways:

<ol style="list-style-type: lower-alpha;"> <li>While holding down the COMMAND and OPTION keys, select Quit from the File menu, and keep holding down the COMMAND and OPTION keys until a dialog box appears. Click YES to rebuild the Desktop.</li> <li>Or, select the Desktop file in ResEdit, and choose Clear from the Edit menu. Quitting ResEdit now rebuilds the Desktop.</li></ol> </li></ol>

Additional Document Types
To add an icon for an additional file type that your application creates, add another icon to the ICN#, another FREF, and entries for the icon and FREF in the BNDL resource.

To add the FREF, open your application with ResEdit, and open the FREFs. Select New to create a new FREF, then set the file type to your new type, and set a new localID (3 for the first additional file type). Close the FREF and select Get Info to change the resource ID to the next in line (130 for the first additional file type).

To add an icon, open the ICN# in the application. Select New or Duplicate to create a new icon. Alter as you like, close it, Get Info, change the ID (again, 130 for the first additional).

Now open the application's BNDL. Find the line of dashes under the ICN#. Click on the line and select New. Fill in the localID and Resource ID to correspond with the icon and FREF you created. Do the same with the line of dashes under FREF.

As before, you must rebuild the Desktop to see the new icons.

Additional query words: MQuickB readme docerr

Keywords: KB34351

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.