Re: Resource Files for Data
- From: "Dave O." <nobody@xxxxxxxxxxx>
- Date: Fri, 9 Feb 2007 10:25:42 -0000
Rick
A "Single string" can contain a lot, in one program I store a 1/3Meg blank
database as a resource so I don't have to pack any extra files with the
program, another has a bunch of zipped up text files, both seem to work a
treat.
Regards
Dave O.
"Rick Raisley" <rraisley@xxxxxxxxxxxxxxx> wrote in message
news:%23PI1f37SHHA.4028@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for the response, Dave. Actually, I am not at all interested in
changing it after the program is compiled. I'm just looking for an easy
way
to change the data ahead of time (Excel spread*** works well, then
recompiling), and not having to have a separate file to read.
Your example works well for a single string. I'm interested in "importing"
a
user-defined data type containing integers, longs and strings (constant
length), with about 1,000 separate entries, each with 50 or so variables.
Would that have to be read as a string, then separated programmatically?
Sounds a bit clumsy, but not painful I guess.
--
Regards,
Rick Raisley
rick@xxxxxxxxxxxxxxxxx
~~~~~~~~~~~~~~~~~~~
HeavyMetal Software Products
www.heavymetalpro.com
"Dave O." <nobody@xxxxxxxxxxx> wrote in message
news:Omg17i5SHHA.4764@xxxxxxxxxxxxxxxxxxxxxxx
Once compiled into an application the resource file cannot be changedIt
without recompiling the application, or at least the application itself
cannot change its own resource which is what I think you are considering.
might be possible to do it if you put a unique sequence into the file asitself
a
marker then had the program search for the marker and then overwrite
with the new data, a technique not unknown in the bad old days of DOSand
programming, but these days such behaviour would be deemed "virus like"
most security models would get very upset at any such attempt.easy.
If you just want to store static data in a resource file then that is
In the VB resource editor load your file as a custom resource then to getit
back use something like this:happy
Public Function LoadResText(MsgName As String) As String
Dim bytA() As Byte
bytA() = LoadResData(MsgName, "CUSTOM")
LoadResText = StrConv(bytA, vbUnicode)
End Function
You can change the "CUSTOM" to anything you want, the MsgName is the id
of
the resource, not that although the default is a numeric it is just as
with strings as ids which can be a lot more meaningful. Note that data isto
stored in Unicode (at least it needs the StrConv hack to restore the file
its original state) regardless of its original format.
Best Regards
Dave O.
"Rick Raisley" <rraisley@xxxxxxxxxxxxxxx> wrote in message
news:%23PzZ4E5SHHA.1200@xxxxxxxxxxxxxxxxxxxxxxx
I've used resource files for years to hold bitmaps and icons in my
apps,
but
that's about it. I have a program that uses a lot of data which I input
from
binary data files, which I have to write code to save in that format (I
don't want plain text files for security reasons).
I thought, maybe a better way would be to incorporate that data into my
resource file instead. I picture an Excel spread*** with rows and
columns
of my data, which I would then export in a comma delimited format and
input
into my Resource file. I figure that will be more secure yet, yet
easier
to
read and modify (in Excel).
I believe the LoadResData() is the function I want to use, and I want
to
read in a comma delimited data structure I've made for several hundred
items, using Excel. Can anyone point me to an example of how to
construct/modify the text file, and how to read it into VB, looping to
read
in all of the variables of the structure?
--
Regards,
Rick Raisley
.
- References:
- Resource Files for Data
- From: Rick Raisley
- Re: Resource Files for Data
- From: Dave O.
- Re: Resource Files for Data
- From: Rick Raisley
- Resource Files for Data
- Prev by Date: Re: vb6 kill file in Vista
- Next by Date: Re: help with listview box please!!!
- Previous by thread: Re: Resource Files for Data
- Next by thread: Re: SQL Server 2000 to Text File Using Jet OLEDB Provider Of VB6
- Index(es):