Announcement

Collapse
No announcement yet.

Text file as #resource

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Text file as #resource

    hi all,
    in this post: http://www.powerbasic.com/support/pb...ad.php?t=22630
    semen describes a way to load a text file with asciiz strings as a resource.
    it will probably be me, but this seems rather complicated...
    maybe this is asking too much but can't it be done in a simpler way?
    basically i want to embed an rtf-file in my exe to display it later as helptext...
    kind regards
    eddy


    ------------------
    [email protected]
    Eddy

  • #2
    Go to:

    http://www.powerbasic.com/forums/For...ML/004429.html

    In that topic I told Henning how to read text embedded in an EXE
    as a resource. My solution reads the entire resource into one
    string buffer. The owning EXE may then do whatever it needs
    with the string data.

    Actually, my technique will work with ANY kind of RCDATA resource.
    I use it to embed my custom DLL's into a PBR, which I then include
    in an EXE. I then distribute the EXE on my website for the users
    of my softwares. Because of the method, I can make the EXE
    autoextracting, autoinstalling.

    Hope this helps!

    Regards,


    ------------------
    Clay C. Clear

    Clay Clear's Software
    mailto:[email protected][email protected]</A>

    Comment


    • #3
      While resources are the best for these situations, you might try BINBAS with the /ASM option..
      This can be included in your code.

      ------------------
      http://www.hellobasic.com
      hellobasic

      Comment


      • #4
        I should've added this in my first reply, in case you need this
        information, also.

        To include a file as a resource into your EXE, make the .RC file as
        follows:

        Code:
            101 RCDATA DISCARDABLE "myfile1.txt"
            102 RCDATA DISCARDABLE "myfile2.doc"
            'etc., etc. - pretty much any kind of file can be put in it,
            'although, for executables, about the only purpose that I can
            'think of would be to make an autoextracting EXE
            '
            'you may use names instead of integer identifiers as follows:
            MYFILE1 RCDATA DISCARDABLE "test1.exe"
            MYFILE2 RCDATA DISCARDABLE "test2.txt"
            'etc. - use whatever names you desire - I don't know how long
            'the names can be
            'remember, if you use numeric identifiers, they must be
            'INTEGER values, NOT LONG ones!
        Hope this helps!

        Best regards,


        ------------------
        Clay C. Clear

        Clay Clear's Software
        mailto:[email protected][email protected]</A>

        Comment


        • #5
          I agree, this IS the best way imo.
          I think i make a small example some day..


          ------------------
          http://www.hellobasic.com
          hellobasic

          Comment


          • #6
            i wrote an rcdata example:
            http://www.powerbasic.com/support/pb...ad.php?t=23149


            ------------------
            http://www.hellobasic.com
            hellobasic

            Comment


            • #7
              Clay, Edwin,
              Thanks a lot for your code! That is what I was looking for!

              BTW Edwin, I have used BinBas before but I didn't know it had an /ASM option...

              Kind regards
              Eddy


              ------------------
              [email protected]
              Eddy

              Comment

              Working...
              X