Problem in Using FindResourceEx API

sivasankam
03-05-2001, 01:06 PM
Hello
I am having problem in Using FindResourceEx API.Can Anyone help me to solve this.
I would realy appreciate your help.

Here is my question

--------------------------------
Here is the sample code I am using to get data from a resource file which is in a dll.
Here, even though I am passing the id as "#1", I am getting data of different id.
Can anyone help me out.

dim strID as string
dim strType as string

strID = "#1"
strType = "#6"
exeHandle = LoadLibrary(RESOURCEDLL)
LangID = 1033
resHandle = FindResourceEx(exeHandle, strType, strID, LangID)

resData = LoadResource(exeHandle, resHandle)
res = LockResource(resData)
resLen = SizeofResource(exeHandle, resHandle)

If resData <> 0 Then
ReDim resBuffer(0 To resLen - 1)
MoveMemory ByVal VarPtr(resBuffer(0)), ByVal resData, resLen
Debug.Print resBuffer
End If

Thanks
Siva

klabranche
03-13-2001, 10:41 AM
What type of resource are you trying to load...
It is suggested to use LoadCursor,LoadIcon,
LoadBitmap functions instead of FindResourceEx and/or the LoadResource function.

Also are you testing to see if exeHandle is returning an error AKA Zero. It sets GetLastError when an error does occur.

Just to be clear you are grabbing the first resource item.

I don't understand your type string.
There are several constants like
RT_CURSOR and RT_STRING you can pass in.
You can also pass in an integer or string if you
are trying to load an application defined type or a
standard defined type in a type library.

http://www.extreme-vb.net/images/icons/smile.gif

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum