getResSize

Requires FM 1.0 Beta 8.5 (Nov 2007) or newer

Syntax

int getResSize(string restype, string resname)

Arguments

restype
The type of the resource. This is either a string (probably "FMDATA" in most cases), or an integer if the resource is a built-in resource type.
resname
The name of the resource

Return

Returns 0 if the resource can't be found or an error occurs, otherwise returns the size of the resource in bytes.

Description

Gets the size of a file that has been embedded as a resource in the plugin DLL.

Some useful resource type values:

1 - RT_CURSOR
Cursor resource
2 - RT_BITMAP
Cursor resource
3 - RT_ICON
Hardware-dependent icon resource
4 - RT_MENU
Menu resource
5 - RT_DIALOG
Dialog resource
6 - RT_STRING
String-table entry
8 - RT_FONT
Font resource
16 - RT_VERSION
Version resource
23 - RT_HTML
HTML Resource

Example

%fml

OnFilterStart: {

  int ressize = 0;

  // Get the size of the built-in FM logo BMP
  // RT_BITMAP Bitmaps are resource type 2
  ressize = getResSize(2, "LOGO2.BMP");

  // Display the size of the resource file
  Info("Size of resource: %d bytes", ressize);

  return true;
}

See Also

getArrayAddress, getResAddress, copyResToArray