Results 1 to 2 of 2

Thread: Embedded files, and stranger things...

  1. #1

    Thread Starter
    Lively Member Zero's Avatar
    Join Date
    Feb 2000
    Posts
    101
    I notice that one can embed files into a VB project. My thought is to embed a couple of RichText (.RTF) files, and then use a RichTextBox control to open them. My question is this: How to I reverse this process? How do I convert the embedded .RTF file back to a regular file? Can I do this?

    -Zero the Inestimable

  2. #2
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    Yeah its not that hard.

    Use a res file and put the
    files into the file using
    custom data.

    then run this sub to
    extract the file.

    Function GetResFile(Index as Integer)
    Dim arr() As Byte
    Dim Fn As Integer
    Dim tempstr As String

    tempstr = App.Path & "\~File.RTF"
    arr() = LoadResData(Index, "CUSTOM")
    Fn = FreeFile

    Open tempstr For Binary As #Fn
    Put #Fn, , arr
    Close #Fn


    'load file into Richtocbox here
    Kill tempstr
    end function

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