getResAddress

Requires FM 1.0 Beta 8.5 (Nov 2007) or newer

Syntax

char* getResAddress(string restype, string resname)

Arguments

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

Return

Returns 0 / false if the resource can't be found or an error occurs, otherwise returns a pointer to the first byte of the resource.

Description

Gets a pointer to data that has been embedded as a resource in the plugin DLL. You can get the size of the data buffer using getResSize.

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
24 - RT_MANIFEST
Manifest Resource

Example

%fml

OnFilterStart: {

  int ressize = 0;
  void* respointer = NULL;

  // Get the size of the manifest resource
  // Type 24 is RT_MANIFEST
  // 2 is the index of the manifest file
  ressize    = getResSize(24, 2);

  // Get a pointer to the manifest data
  respointer = getResAddress(24, 2);

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

  // Display the manifest string itself
  Info(respointer);

  return true;
}

See Also

copyResToArray, getArrayAddress, getResSize