Here some infos for enumeration icons/icons group
It is possible to have alphanumerical identifier for resource, that is ResName in the enumeration callback (in your code EnumResNameProc() proc) could be a pointer to a string. Such cases are not common but exist.
FindResource must take care of that (see MS remark here
http://msdn.microsoft.com/en-us/library ... S.85).aspx), API UpdateResource_() too.
here are a procedure and a macro for that (X86 only, it's OK in ASCII or unicode mode)
Code: Select all
Macro MAKEINTRESOURCE(INT)
(INT & $FFFF)
EndMacro
Procedure IS_INTRESOURCE(Val)
Select (Val & $FFFF0000)
Case 0
;// it's a numerical identifer for resource
ProcedureReturn #True
Default
;// it's a pointer to a string for resource
ProcedureReturn #False
EndSelect
EndProcedure
I've done many many many tries (for PureIconManager) but the only way to get it works is to use it inside the enumeration callback else you will get an error (87 as invalid parameter, but another error code is possible). May be a different segment for string storage (?).
That's only the way i foud to get it works.
If you add this in your callback :
Code: Select all
If IS_INTRESOURCE(ResName)
Else
;// it's a pointer to a string for resource
Debug "String identifier PeekS(ResName) = " + PeekS(ResName)
EndIf
you will display the string if the resource use such identifier.
If you change in your code
Code: Select all
*GrpIconDir = LoadResource_(LibHandle, FindResource_(LibHandle, MAKEINTRESOURCE(IconGroupID()), #RT_GROUP_ICON))
by
Code: Select all
ForEach IconGroupID()
If IS_INTRESOURCE(IconGroupID())
;// it's a numerical identifer for resource
*GrpIconDir = LoadResource_(LibHandle, FindResource_(LibHandle, MAKEINTRESOURCE(IconGroupID()), #RT_GROUP_ICON))
Else
;// it's a pointer to a string for resource
Debug Bin(IconGroupID())
*GrpIconDir = LoadResource_(LibHandle, FindResource_(LibHandle, PeekS(IconGroupID()), #RT_GROUP_ICON))
EndIf
it will failed if alphanumerical identifier is used (error 87).
That's why such code must be used inside enumeration callback.
Here is a zip file with 2 exe files (each with only one group with alphanumerical id). As you will see, the string is always in capital letter. If you try to use it without capital letter, it will failed.
For file cpviewer.exe, the group string is IDI_APPICON and for isignup.exe the group string is ICO_APP
zip file
here
I hope it will help you.