RESNEXT() Function - Get Next Resource

Syntax

RESNEXT(res_handle,res_id${,ERR=lineref})

Description

The RESNEXT() function returns a string assigning the next valid resource in the resource file to the template defined by RESFIRST().

Parameter

Description

res_handle

Resource handle returned by the RESOPEN() function.

res_id$

String returned by the RESFIRST() function or a previous use of the RESNEXT() function.

ERR=lineref

Branch to be taken if an error occurs during execution.

If res_id$ does not refer to a valid resource within the file, RESNEXT() generates an !ERROR=11. When there are no more resources within the file, RESNEXT() generates an !ERROR=2.

Example

rem build a list of top level forms in a resource file (.BRC) by name and id
resource_handle=resopen("my_resource_file.brc")
template$="id:u(2),class:u(1),type:u(1)"
dim resource$:template$
temp_data$="class:u(1),type:u(1),emask:u(4),flags:u(4),"
temp_data$=temp_data$+"con_id:u(2),id:u(2),x:u(2),y:u(2),"
temp_data$=temp_data$+"w:u(2),h:u(2),menuoff:u(2),child:u(2),"
temp_data$=temp_data$+"name:c(10*=0),title:c(10*=0)"
dim resource_data$:temp_data$
resource$=RESFIRST(resource_handle,err=er_no_resources)
done=0
repeat
rem is it a top level form?
If resource.class = 0 and resource.type = 1 then
: resource_data$=RESINFO(resource_handle,resource$);
: resource_list$=resource_list$+resource_data.name$;
: resource_list$=resource_list$+$00$+str(resource.id)+$0A$
resource$=RESNEXT(resource_handle,resource$,err=er_loop_error)
continue
er_loop_error:
if err=2 then
: done=1,loop_good = 1
: else
: done=1,loop_good = 0
until done
er_no_resources:
stop

See Also

RESCLOSE Verb

RESFIRST() Function

RESGET() Function

RESGET() Function - BBj

RESINFO() Function

RESINFO() Function - BBj

RESOPEN() Function

RESOPEN() Function - BBj

Functions - Alphabetical Listing