Results 1 to 4 of 4

Thread: Resources

  1. #1

    Thread Starter
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722
    I'm making a .dll like cards.dll, and i want to save the pics for the cards in the dll. I'm using the resource editor, but it only wants to save bmp's as pictures. My cards are gif's. I can save them as custom resources, but when i read them, they are returned as a byte array. How can i 'transform' them to IPictureDisp?

    r0ach™
    Don't forget to rate the post

  2. #2
    Lively Member
    Join Date
    Sep 1999
    Location
    Liverpool, UK
    Posts
    64

    Thumbs up

    Here you go, just pass in the location were you want the file saved, and the id number of the resource. It assumes that your resource is in 'custom', if it isn't you can add another parameter to this...

    Code:
    ''To save a gif from the resource file
    BuildResource("c:\temp\my gif.gif",101)
    
    ''This function will save any custom resource file on to your disk.
    Public Function BuildResource(destFILE As String, resID As Integer) As String
        On Error GoTo ErrorBuildFileFromResource
        Dim resBYTE() As Byte
        resBYTE = LoadResData(resID, "CUSTOM")
        Open destFILE For Binary Access Write As #1
        Put #1, , resBYTE
        Close #1
        
        Exit Function
    ErrorBuildFileFromResource:    
        Exit Function
    End Function

  3. #3

    Thread Starter
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722
    Thanks.

    I would prefer not to save the data to a file. I just want to load it into a picture box.

    r0ach™
    Don't forget to rate the post

  4. #4
    Lively Member
    Join Date
    Sep 1999
    Location
    Liverpool, UK
    Posts
    64
    Not sure if you can

    Can't you get your app to dump the gifs somewere on the pc when it loads (i.e. in the temp folder) and then delete them when it closes ??

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