rmitchel@bbn.com (Rob Mitchell) (03/21/91)
Need help modifying 'STR#' resources from application. Each STR# has between 3 and 4 strings inside of it. I use GetIndResource to actually get the strings, but I don't know of a SetIndResource function to write them back. You can make the assumption that each string is Str32 (33 bytes long). Any ideas appreciated!!! Rob Mitchell Advanced Simulation Division Unix & Macintosh Engineer BBN Systems & Technologies Internet: rmitchel@vax.bbn.com 33 Moulton Street MS: 8/C Primary Dwelling: 617-873-4041 Cambridge, MA 02138 Secondary Dwelling: 617-873-4071 FAX: 617-873-4315 These opinions are mine and mine only. They do not represent BBNs' opinions.
2fmlcalls@kuhub.cc.ukans.edu (03/21/91)
In article <63341@bbn.BBN.COM>, rmitchel@bbn.com (Rob Mitchell) writes: > > > Need help modifying 'STR#' resources from application. > > Each STR# has between 3 and 4 strings inside of it. I use > GetIndResource to actually get the strings, but I don't know > of a SetIndResource function to write them back. You can make > the assumption that each string is Str32 (33 bytes long). > > Any ideas appreciated!!! > > > > Rob Mitchell Advanced Simulation Division Since GetIndResource returns a handle, you can lock doen the handle, modify the contents of it adn then mark the resource as changed or simply WriteResource. If you mark it as changed, it will be updated when the app quits. If you're paranoid (as I am) WriteResource will write it out immediately. The trick is changing the contents of the handle. In C that's probably pretty easy to do. In Pascal you would probably have to pull the StringPtr(myRes) to coerce it. I had trouble doing this, so I simply defined my own type (for saving high scores in a game). In your case the type might look like: type fourStrings=record str1,str2,str3,str4:string[32]; end; fourPtr: ^fourStrings; fourHand: ^fourPtr; var theStrings:fourHand; Now use GetNamedResource() or some such variant to read in your own resource type (say, 'str4'). Manipulate the fields of theStrings, and WriteResource. It works. john calhoun