Resource Template 
Author Message
 Resource Template

Using ResEdit I created my own resource type. It consists of the following
data types:

CSTR - C String
CSTR - C String
BOOL - Boolean
CSTR - C String
BOOL - Boolean

In REALbasic I want to put all this data into two Boolean variables and
three string variables. Any ideas? (I know nothing about all that HEX
stuff:-(



Wed, 10 Aug 2005 02:32:05 GMT  
 Resource Template

Quote:

> Using ResEdit I created my own resource type. It consists of the following
> data types:

> CSTR - C String
> CSTR - C String
> BOOL - Boolean
> CSTR - C String
> BOOL - Boolean

> In REALbasic I want to put all this data into two Boolean variables and
> three string variables. Any ideas?

Read the data out of the resource as a string, then create a
MemoryBlock the same length as the string.  Stuff the string into the
MemoryBlock.  Then you can grab these values from the MemoryBlock
easily.

Check out the documentation for the ResourceFork and MemoryBlock
classes.



Wed, 10 Aug 2005 03:41:52 GMT  
 Resource Template

Quote:



> > Using ResEdit I created my own resource type. It consists of the
> > following data types:

> > CSTR - C String
> > CSTR - C String
> > BOOL - Boolean
> > CSTR - C String
> > BOOL - Boolean

> > In REALbasic I want to put all this data into two Boolean variables and
> > three string variables. Any ideas?

> Read the data out of the resource as a string, then create a MemoryBlock
> the same length as the string.  Stuff the string into the MemoryBlock.
> Then you can grab these values from the MemoryBlock easily.

> Check out the documentation for the ResourceFork and MemoryBlock classes.

Note also that it'd be much easier to manage if your data were organized
this way:

Bool, Bool, Cstr, Cstr, Cstr.

Why? Because Bools are fixed length, while the strings are not.
MemoryBlock.BooleanValue(0) will always be the first bool,
MemoryBlock.BooleanValue(1) will always be the second bool, and
MemoryBlock.CString(2) will always be the first string. Easy math.

The way you've organized it, you'll always have to find the length of
the first two Cstrings to get the first bool, and you'll have to find
the length of all Cstrings to get the second bool.

HTH.



Wed, 10 Aug 2005 06:55:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Clarion Templates and resource files

2. Resource Fork has no Resource Fork?

3. Find resources and resource name

4. Extracting Resource String from Resource Table

5. Internet application template vs. Web application template

6. New templates added to Solace Software Free template set

7. New Templates: the Internet Framework Templates - HTTP Server Edition Version 1.5

8. ABC templates... can i change an applications templates

9. A Template to Write Templates?

10. ANN: New release of S.C.A. Micro Templates (Browse Header Sort and Reverse Sort Template)

11. Clarion templates to ABC templates

12. Kit Template Nova Vida (Template para Backup ON-Line) somente para Brazileiros e Portugueses por enquanto

 

 
Powered by phpBB® Forum Software