La Web del Programador: Comunidad de Programadores
 
    Pregunta:  20167 - CONSULTA SOBRE LA API FREERESOURCE
Autor:  Rafael Alonso García
Hola a todos, tengo una consulta que haceros, ¿sabría alguien decirme cómo tengo que aplicar la función de API FreeResource?
La declaración de es función es: Declare Function FreeResource Lib "kernel32" (ByVal hResData As Long) As Long.
Creo que sirve para liberar recursos, pero no estoy seguro.

  Respuesta:  JOSE TERUEL SANCHEZ
ESTO ES TODO LO QUE HE PODIDO ENCONTRAR SOBRE FREERESOURCE, ESPERO QUE AUN ESTANDO EN INGLES TE SIRVA.

FreeResource Function

--------------------------------------------------------------------------------

The FreeResource function decrements (decreases by one) the reference count of a loaded resource. When the reference count reaches zero, the memory occupied by the resource is freed.

Syntax

BOOL FreeResource( HGLOBAL hglbResource
);
Parameters

hglbResource
[in] Handle of the resource. It is assumed that hglbResource was created by LoadResource.
Return Value

If the function succeeds, the return value is zero.

If the function fails, the return value is non-zero, which indicates that the resource has not been freed.


Remarks

The reference count for a resource is incremented (increased by one) each time an application calls the LoadResource function for the resource.

The FreeResource function is obsolete and is only supported for backward compatibility with 16-bit Microsoft® Windows®. It has been replaced by the following functions: Resource type FreeResource replacement
Accelerator DestroyAcceleratorTable
Bitmap DeleteObject
Cursor DestroyCursor
Icon DestroyIcon
Menu DestroyMenu

The system automatically deletes these resources when the process that created them terminates. However, calling the appropriate function saves memory and decreases the size of the process's working set. For more information, see LoadResource.

Function Information

Header Declared in Winbase.h, include Windows.h
Import library Kernel32.lib
Minimum operating systems Included in Windows 95, Windows NT 3.1

See Also

LoadResource, DestroyAcceleratorTable, DeleteObject, DestroyCursor, DestroyIcon, DestroyMenu