/// <summary> /// The callback function that is being called for each resource (RT_GROUP_ICON, RT_ICON) in the executable module. /// The function stores the resource name of type RT_GROUP_ICON into the GroupIconsList and /// stores the resource name of type RT_ICON into the IconsList. /// </summary> /// <param name="hModule">The module handle.</param> /// <param name="lpszType">Specifies the type of the resource being enumurated (RT_GROUP_ICON, RT_ICON).</param> /// <param name="lpszName"> /// Specifies the name of the resource being enumurated. For more ifnormation, see the Remarks /// section. /// </param> /// <param name="lParam">Specifies the application defined parameter passed to the EnumResourceNames function.</param> /// <returns>This callback function return true to continue enumuration.</returns> /// <remarks> /// If the high bit of lpszName is not set (=0), lpszName specifies the integer identifier of the givin resource. /// Otherwise, it is a pointer to a null terminated string. /// If the first character of the string is a pound sign (#), the remaining characters represent a decimal number that /// specifies the integer identifier of the resource. For example, the string "#258" represents the identifier 258. /// #define IS_INTRESOURCE(_r) ((((ULONG_PTR)(_r)) >> 16) == 0) /// </remarks> private bool EnumResourcesCallBack(IntPtr hModule, ResourceTypes lpszType, IntPtr lpszName, IntPtr lParam) { switch (lpszType) { case ResourceTypes.GROUP_ICON: IconNamesList.Add(new ResourceName(lpszName)); break; } return(true); }
/// <summary> /// Releases the resources of that object. /// </summary> public void Dispose() { if (ModuleHandle != IntPtr.Zero) { try { NativeMethods.FreeLibrary(ModuleHandle); } catch { } ModuleHandle = IntPtr.Zero; } IconNamesList?.Clear(); }