Results 1 to 11 of 11

Thread: LoadResData [RESOLVED]

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Resolved LoadResData [RESOLVED]

    I made a resource file and added it to an activex dll and compiled it. The dll contains mainly gif images. I know the code would be something like this if the resource file was in the exe of the program.

    b = LoadResData(101, "Custom")

    But how do I load the dll and then pull that data out of the dll? I can't seem to find an example coding that shows how to do this from an dll. Only from withing the exe of a program. I think I can do the rest after I pull that resource data from the dll, but I need help getting that data first.

    Thanks for any help in advance.
    Last edited by simgirl; Apr 3rd, 2005 at 09:08 PM. Reason: Resolved

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: LoadResData

    You would still use the same code but within a class in the DLL. You would then have to create some kind of method that would return the data.

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Re: LoadResData

    Would that only been needed to be coded then in the dll to return an loadres data and how would you do that? I'm already able to pull bmp's, icon's, and string's from an resource stored in an dll but not anything in the Custom section of a resource.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: LoadResData

    VB Code:
    1. Public Function GetCustomData(Index As Variant) As Byte()
    2.     GetCustomData = LoadResData(Index, "Custom")
    3. End Function

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Re: LoadResData

    If thats put into a class within the activex dll, how would you then called that function from your program?

    Lets say I have an activex dll called: images.dll
    It contains 1 gif in customs (101, "Customs").

    How would I need to write the code to get that gif?
    Last edited by simgirl; Apr 3rd, 2005 at 11:44 AM.

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: LoadResData

    You would of course need to set a reference to your DLL. Then create an object from the class you wrote.
    VB Code:
    1. Dim oPic As TheClassName
    2. Dim bArr() As Byte
    3.  
    4. Set oPic = New TheClassName
    5. bArr = oPic.GetCustomData(101)
    You now have a byte array representing the custom data. You can write that to a file and then load it using LoadPicture.

  7. #7

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Re: LoadResData

    Thank you so much.

    I'll give that a try.

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Re: LoadResData

    Do you always have to set a reference to the dll just to get custom data? I seem to be able to get bmp's, icon's, and string's without setting a reference to the dll ok.

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: LoadResData

    Quote Originally Posted by simgirl
    Do you always have to set a reference to the dll just to get custom data? I seem to be able to get bmp's, icon's, and string's without setting a reference to the dll ok.
    If the res file is in the dll you will not be able to access it without setting a reference. But if you have a project group in VB your standard EXE project will probably have a reference set automatically.

  10. #10

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    51

    Re: LoadResData

    I found a piece of code that shows me how to do it now exactly the way I wanted to do it. You don't even have to reference the dll using this code. I'll post a link on here, once I find the link again, so others can try the code if they want.

  11. #11
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    507

    Re: LoadResData [RESOLVED]

    Got it, I fixed it. Its working now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width