Code: Select all
#MB_USERICON = $00000080
Global NewList IconGroupID(),msg.MSGBOXPARAMS,LibHandle,LibName$
Procedure EnumResNameProc(ResHandle, ResType, ResName, AppParam)
AddElement(IconGroupID())
IconGroupID() = ResName
ProcedureReturn #True
EndProcedure
Procedure EnumResTypeProc(ResHandle, ResType, AppParam)
If ResType = #RT_GROUP_ICON
EnumResourceNames_(ResHandle, ResType, @EnumResNameProc(), 0)
EndIf
ProcedureReturn #True
EndProcedure
Procedure Icon_index(LibName$)
LibHandle = LoadLibraryEx_(@LibName$, 0, #LOAD_LIBRARY_AS_DATAFILE)
If LibHandle = 0
MessageRequester("Error", "Unable to load library " + LibName$, #MB_ICONERROR)
End
EndIf
EnumResourceTypes_(LibHandle, @EnumResTypeProc(), 0)
ForEach IconGroupID()
*GrpIconDir = LoadResource_(LibHandle, FindResource_(LibHandle, IconGroupID(), #RT_GROUP_ICON))
Debug " Index "+Str(item)+" = "+Str(IconGroupID())
item + 1
Next
EndProcedure
LibName$ = "regedit.exe"
Icon_index(LibName$)
Lastindex = ListSize(IconGroupID()) - 1
SelectElement(IconGroupID(), 0) ;Select any available index (from 0 to Lastindex)
With msg
\cbSize = SizeOf(MSGBOXPARAMS)
\hwndOwner = GetForegroundWindow_()
\hInstance = LibHandle
\lpszText = @"Text"
\lpszCaption = @"Title"
\dwStyle = #MB_USERICON | #MB_YESNO
\lpszIcon = IconGroupID()
EndWith
MessageBoxIndirect_(@msg)
FreeLibrary_(LibHandle)