M
Mythran
I am trying to get an API (EnumResourceNamesW - kernel32) to pass a specific
parameter to the call-back function. The declaration I currently have for
EnumResourceNamesW is:
[
DllImport(
"kernel32.dll",
EntryPoint = "EnumResourceNamesW",
CharSet = CharSet.Unicode,
SetLastError = true
)
]
static extern bool EnumResourceNamesWithID(
IntPtr ModuleHandle,
uint Type,
EnumResNameDelegate EnumFunc,
IntPtr Param
);
I have a delegate as follows:
private delegate bool EnumResNameDelegate(
IntPtr ModuleHandle,
IntPtr Type,
IntPtr Name,
IntPtr Param
);
I want to pass an ArrayList to the EnumResourceNamesWithID and have it pass
that to the EnumResNameDelegate method. But, since Param is an IntPtr, I
can't. Is there a way to do what I am trying to accomplish?
Currently, I don't pass anything. I have a member variable in the class and
am using this var to store the values of the resources found. But I want to
do this w/o a member variable. Any suggestions/help?
Thanks,
Mythran
parameter to the call-back function. The declaration I currently have for
EnumResourceNamesW is:
[
DllImport(
"kernel32.dll",
EntryPoint = "EnumResourceNamesW",
CharSet = CharSet.Unicode,
SetLastError = true
)
]
static extern bool EnumResourceNamesWithID(
IntPtr ModuleHandle,
uint Type,
EnumResNameDelegate EnumFunc,
IntPtr Param
);
I have a delegate as follows:
private delegate bool EnumResNameDelegate(
IntPtr ModuleHandle,
IntPtr Type,
IntPtr Name,
IntPtr Param
);
I want to pass an ArrayList to the EnumResourceNamesWithID and have it pass
that to the EnumResNameDelegate method. But, since Param is an IntPtr, I
can't. Is there a way to do what I am trying to accomplish?
Currently, I don't pass anything. I have a member variable in the class and
am using this var to store the values of the resources found. But I want to
do this w/o a member variable. Any suggestions/help?
Thanks,
Mythran