Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
<DllImport("kernel32.dll", SetLastError:=True)> _
Private Shared Function EnumResourceTypes(ByVal hModule As IntPtr, ByVal lpEnumFunc As EnumResTypeProc, ByVal lParam As IntPtr) As Boolean
Private Shared Function EnumResourceTypes(ByVal hModule As IntPtr, ByVal lpEnumFunc As EnumResTypeProcDelegate, ByVal lParam As IntPtr) As Boolean
End Function
''' <summary>
''' Enumerates a module for predefined resource types.
''' </summary>
''' <param name="fullPath">Address of a valid Win32 module.</param>
''' <param name="resources">If NULL, all resource types will be enumerated.</param>
''' <returns></returns>
''' <remarks></remarks>
Public Shared Function GetResourceTypes(fullPath As String, _
resources() As ResourceType) As Dictionary(Of ResourceType, _
List(Of String))
Dim hMod As IntPtr = LoadLibraryEx(fullPath, IntPtr.Zero, LoadLibraryFlags.LOAD_LIBRARY_AS_DATAFILE)
If IntPtr.Zero.Equals(hMod) Then Return Nothing
If IsNothing(resources) OrElse resources.Length = 0 Then resources = _
CType([Enum].GetValues(GetType(ResourceType)), ResourceType())
Dim LS As New Dictionary(Of ResourceType, List(Of String))
Dim typeCallBack As New EnumResNameProcDelegate( _
Function(hmodule As IntPtr, lpType As IntPtr, lpzName As IntPtr, lParam As IntPtr)
Dim SLst As List(Of String) = Nothing
Dim rt = CType(CInt(lpType), ResourceType)
Dim ResID = MAKEINTRESOURCE(lpzName)
If LS.TryGetValue(rt, SLst) Then
SLst.Add(ResID)
Else
SLst = New List(Of String)({ResID})
LS.Add(rt, SLst)
End If
Return True
End Function)
Dim callBack As New EnumResTypeProc( _
Function(hm As IntPtr, rType As IntPtr, lp As IntPtr)
Dim rt = CType(CInt(rType), ResourceType)
If Array.IndexOf(resources, rt) > -1 Then
EnumResourceNames(hm, rType, typeCallBack, IntPtr.Zero)
End If
Return True
End Function)
EnumResourceTypesW(hMod, callBack, IntPtr.Zero)
FreeLibrary(hMod)
Return LS
End Function
' Jens. 12/16/2012
' *****************************************
Alternative Managed API:
Do you know one? Please contribute it!
The EnumResourceTypes API
12/15/2012 7:51:55 PM - -216.108.207.123
Used with the EnumResourceTypes and EnumResourceTypesEx functions
10/31/2009 7:17:36 AM - -216.108.207.123
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).