GetResourceQuantity |
Size = GetResourceQuantity(Index) |
|
Parameters: Index = The Index of the resource in the internal resource buffer
|
Returns:
Size = The Size (in bytes) of the resource |
|
The GetResourceQuantity function returns the total number of files that have been attached via #AddResource directive during compilation.
FACTS:
* GetResourceQuantity will return 0 if no resources exist.
* Resources can be an alternative to using DATA statements. * For more information about resource binding see the #AddResource directive.
|
|
Example Source: Download This Example // Attach this file from the common media folder in the help // files, which is located two folders down from where this // example is stored. #AddResource "..\..\Media/Hello-World.txt" // Search for a bound resource using the same file name Index=findresourceindex("..\..\Media/Hello-World.txt") // If the resource was found it's index will be 0 or higher If Index>-1 // Display information about this resource Print "Resource Found" Address =getresourceptr(Index) Size =getresourcesize(Index) Print "Address In Memory:"+Str$(Address) Print "Size:"+Str$(Size)+" bytes" // Since we know this is a text resource // next we'll read these bytes into a string // using peekstring s$=PeekString(Address,Size) // Now we'll split this string into an array to display it Dim Rows$(0) // remove any ASC chr 13 from the string s$=Replace$(s$,Chr$(13),"") // split the string on the ASC II chr 10 RowCount=SplitToArray(s$,Chr$(10),Rows$()) // Display the rows of this text file For lp =0 To RowCount-1 Print Rows$(lp) Next EndIf // DIsplay the number of bound resources in memory Print "Number OF Resources #"+Str$(getresourcequantity()) Sync WaitKey |
|