Use .ini as a resource

vb6 Kuwait
  • 15 years ago

    Hi All,

    i am using  an .INI file in my application. but i want to use it as a resource, say embedded in some dll, rather to make it viewable physically.

    how can i make it possible?

    plz help...

    thanks for your time in advance...



  • 15 years ago

    any ideas...plzz...

  • 15 years ago

    Using an .ini I'm not quite sure by what u mean by an embedding an .dll but there are two API calls which lets you save and get program information from an .ini what they are I can't remeber and the site I've been using for API is at  home right now.... try query the msdn libary about it.

  • 15 years ago

    Hi! thanks for your response.

    let me elaborate my problem:

    i am using .INI files as a database file for my project which at present i have kept on the App path. but i dont want that file to be visible by anyone so, i wish to hide it. i think it can be embedded into a .dll so as to access it from there.

    but i dont know how to implement it. is there any other way to implement this task? any ideas??




  • 15 years ago

    I don't think so .ini files arn't mean't to be used as a database there the old equivilent to the windows registry, used to store the program settings (route path) etc. look at the windows registry for an example.

    a better way to do a flat-file database and not to not let anyone see the contents is to use a .dat file with the file system commands there a lot easier than ado or dao langerages given that its a flat file to create a record create a new type eg.:

    Type NameRecord
    name as string * 15
     end Type

    Public sub Writetodatabase(byval strname as string)

    Dim Person as NameRecord
    Dim Intfile as Integer = strname

    Intfile = freefile() 'sets Intfile equal to the next free filenumber

    Open filename.dat for random Len=Len(nameRecord) as Intfile 'Len Is the size of the record
    Put Intfile, [record number], fido 'record number is optional
    close Intfile

    End sub

    and to retive a record

    Public Function RetiveRecord as nameRecord

    Dim Intfile as Integer
    Dim Person as Record

    Intfile = freefile()
    Open filename.dat for random Len=Len(nameRecord) as Intfile
    Get Intfile,[record number], Person
    RetiveRecord = Person

    End sub

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“My definition of an expert in any field is a person who knows enough about what's really going on to be scared.” - P. J. Plauger