ResourceFree

Overview

The ResourceFree function deletes dynamically created resources, freeing the memory allocated for them. It is used to manage memory consumption when actively working with resources.

Signature

bool ResourceFree(const string resource_name);

Parameters

  • resource_name (in): The name of the resource to be freed. This name must start with "::".
  • Returned Value

  • true: If the function successfully freed the resource.
  • false: If the function failed. Call GetLastError() to retrieve error information.
  • Notes

  • This function only deletes dynamic resources created by the program using ResourceCreate().
  • Graphical objects (like OBJ_BITMAP and OBJ_BITMAP_LABEL) that are bound to the resource being deleted will continue to be displayed correctly after the resource is freed. However, these objects will no longer be able to use the deleted resource.
  • Static resources are not affected by this function.
  • Related Functions

  • ResourceCreate(): Creates dynamic resources.
  • GetLastError(): Retrieves the last error code.
  • ObjectCreate(): Creates graphical objects.
  • PlaySound(): Plays a sound resource.
  • ObjectSetString(): Sets string properties for objects.
  • OBJPROP_BMPFILE: Property for specifying a BMP file for an object.
  • Platform Support

  • MQL4