Microsoft KB Archive/32975

= Multiple Resources with Same ID Number Saved in Resource File =

Article ID: 32975

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 1.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Interpreter 3.0 for Macintosh

-



This article was previously published under Q32975



SUMMARY
The routines that save resources to a resource file (listed below) do NOT overwrite (replace) an existing resource that has the same ID number. Instead, the following routines place a second resource with the same ID in the file:

AddCursor, AddIcon, AddPattern, AddPicture, AddRes, AddString, SaveArray, SaveCursor, SaveIcon, SavePattern, SavePicture, SaveString

You can avoid writing two resources with the same ID number in a resource file by executing GetRes to get the handle of the existing resource, then executing RemoveRes to delete it before saving the new resource.

This information applies to the above routines in Microsoft QuickBASIC Version 1.00 (MBLC toolbox library routines), Microsoft BASIC Compiler Version 1.00 (LIBRARY &quot;ToolLib&quot; routines), and Microsoft BASIC Interpreter Version 3.00 for the Apple Macintosh (LIBRARY &quot;ToolLib&quot; routines).



MORE INFORMATION
The Add*** routines take a resource identified by a handle in memory (heap) and put that resource into a resource file on disk. (The Get*** routines do the converse operation. Get*** routines take a resource identified by an ID number in a resource file, place that resource into memory, and assign it a handle.)

The Save*** routines store a BASIC variable (or array) into a resource file on disk. (The Load*** routines do the converse operation. Load*** routines take a resource identified by an ID number in a resource file and place that resource into a BASIC variable or array in memory.)

The following Add*** and Save*** routines put resources into a resource file (and the corresponding Get*** and Load*** routines in parentheses show the reverse operation):


 * 1) AddCursor, AddIcon, AddPattern, AddPicture, AddRes, AddString (GetCursor, GetIcon, GetPattern, GetPicture, GetRes, GetString)
 * 2) SaveArray, SaveCursor, SaveIcon, SavePattern, SavePicture, SaveString (LoadArray, LoadCursor, LoadIcon, LoadPattern, LoadPicture LoadString)

In QuickBASIC, Toolbox library routines such as Add***, Get***, Save***, and Load*** are stored as MBLC resources in QuickBASIC itself. In the earlier BASIC Compiler Version 1.00, and in the earlier BASIC Interpreter Version 3.00, Toolbox library routines are provided in a separate library file called TOOLLIB on the BASIC Toolbox Disk (Disk 2 of 2).

Additional query words: BasicCom MQuickB

Keywords: KB32975

-

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

© Microsoft Corporation. All rights reserved.