RESFIRST() Function - Get Resource Identifier
Syntax
RESFIRST(res_handle{,ERR=lineref})
Description
The RESFIRST() function retrieves the resource identifier and creates a string that provides resource ID information.
Parameter |
Description |
res_handle |
Handle returned by RESOPEN(). |
ERR=lineref |
Branch to be taken if an error occurs during execution. |
RESFIRST() returns an !ERROR=2 if no resources exist in the file.
Resource Identifier String Template
The following template is used by the RESINFO() function to obtain information about the referenced resource.
id:u(2),type:u(2)
Use TMPL( chan ,IND=0) to get the template definition. To avoid retrieving incorrect information, do not edit the contents of the resource file while accessing the file in a program.
Example
0010 LET RES_HANDLE=RESOPEN("resource.brc")
0020 LET RES_ID$=RESFIRST(RES_HANDLE)
0030 SWITCH DEC(RES_ID$(3,2))
0040 CASE 1; REM ' Window
0050 DIM RES_INFO$:"class:u(1),type:u(1),emask:u(4),flags:u(4),context:i(2),id:u(2),x:u(2),y:u(2),w:u(2),h:u(2),menuoffset:u(2),childlist:u(2),name:c(1*=0),title:c(1*=0)"
0060 BREAK
0070 CASE 2; REM ' Menu Bar
0080 DIM RES_INFO$:"class:u(1),type:u(1),flags:u(4),id:u(2),accelkey:u(2),submenu:u(2),siblingmenu:u(2),name:c(1*=0),title:c(1*=0)"
0090 BREAK
0100 CASE 3; REM ' Popup Menu
0110 DIM RES_INFO$:"class:u(1),type:u(1),id:u(2),menuoffset:u(2),name:c(1*=0)"
0120 BREAK
0130 CASE 4; REM ' Child Window
0140 DIM RES_INFO$:"class:u(1),type:u(1),emask:u(4),flags:u(4),context:i(2),id:u(2),x:u(2),y:u(2),w:u(2),h:u(2),childlist:u(2),siblinglist:u(2),name:c(1*=0),title:c(1*=0)"
0150 BREAK
0160 CASE 5; REM ' Image list
0170 REM - imagelist is not implemented
0180 BREAK
0190 CASE DEFAULT; ESCAPE; REM ' should never get here
0200 BREAK
0210 SWEND
0220 LET RES_INFO$=RESINFO(RES_HANDLE,RES_ID$)
0230 PRINT FATTR(RES_INFO$)