From: Bob Riemersma on
"MM" <kylix_is(a)yahoo.co.uk> wrote in message
news:lbmnh515hlhm0d4s52sekob7ftikb8mk6m(a)4ax.com...
> The way I've done this in the past is simply to whack a .txt file into
> the folder and read it in Form_Load, but since I have all the time in
> the world, being retired, I thought I'd experiment with other ways.
> Plus, it would be one less file on the user's PC.
>
> I think the rc.exe route is the best so far. I tried a freeware
> resource file editor that understood .res files, but, if anything,
> that was even more confusing.
>
> What I'll do now is simply edit the STRINGTABLE resource in the
> resource definition file or add to it, then recompile the .res file,
> then in VB6 remove the superseded .res file and replace it with the
> newer one.
>
> MM

It really sounds as if you have a modest amount of text you want to
manipulate, but just enough so that using inline String literals is awkward.

For something this basic I really can't see why the Resource Editor in the
VB6 IDE is such a problem, but I'm beginning to suspect you're operating
under a misconception. You probably do NOT want to create a String Table
resource for this at all. Those really are meant for things like localizing
label and prompt text. Have you considered a simpler approach such as a
Custom resource?

You can use Notepad to create and edit your text as a .TXT file. Just make
sure to save it in ANSI format. Then create a Custom resource in Resource
Editor, loading this file into it as binary data. If you simply have one of
these you don't even need to change the default Type and Id tags on it. I
often do this for small programs that need a really basic "Help" dialog with
~ 2K to 6K of text in them.

HelpDlg.frm (one TextBox):

Option Explicit

Private Sub Form_Load()
Set Icon = MainUI.Icon
txtHelp.Text = StrConv(LoadResData(101, "CUSTOM"), vbUnicode)
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbFormControlMenu Then
Cancel = True
Me.Hide
End If
End Sub

Private Sub Form_Resize()
If WindowState <> vbMinimized Then
txtHelp.Move 0, 0, ScaleWidth, ScaleHeight
End If
End Sub

I'm just displaying it there, but nothing says you can't parse it into
individual values by Splitting on vbNewLine and "," or whatever you like. I
wouldn't bother making 88 individual resources this way though!

Going to RC.exe or a 3rd party resource editing tool seems like an absurd
complexity for things this simple. Yes Resource Editor takes some getting
used to but most of the time you only need to make simple use of it anyway.

From: MM on
On Sun, 6 Dec 2009 12:35:49 -0500, "Bob Riemersma" <nospam(a)nil.net>
wrote:

>"MM" <kylix_is(a)yahoo.co.uk> wrote in message
>news:lbmnh515hlhm0d4s52sekob7ftikb8mk6m(a)4ax.com...
>> The way I've done this in the past is simply to whack a .txt file into
>> the folder and read it in Form_Load, but since I have all the time in
>> the world, being retired, I thought I'd experiment with other ways.
>> Plus, it would be one less file on the user's PC.
>>
>> I think the rc.exe route is the best so far. I tried a freeware
>> resource file editor that understood .res files, but, if anything,
>> that was even more confusing.
>>
>> What I'll do now is simply edit the STRINGTABLE resource in the
>> resource definition file or add to it, then recompile the .res file,
>> then in VB6 remove the superseded .res file and replace it with the
>> newer one.
>>
>> MM
>
>It really sounds as if you have a modest amount of text you want to
>manipulate, but just enough so that using inline String literals is awkward.
>
>For something this basic I really can't see why the Resource Editor in the
>VB6 IDE is such a problem, but I'm beginning to suspect you're operating
>under a misconception. You probably do NOT want to create a String Table
>resource for this at all. Those really are meant for things like localizing
>label and prompt text. Have you considered a simpler approach such as a
>Custom resource?
>
>You can use Notepad to create and edit your text as a .TXT file. Just make
>sure to save it in ANSI format. Then create a Custom resource in Resource
>Editor, loading this file into it as binary data. If you simply have one of
>these you don't even need to change the default Type and Id tags on it. I
>often do this for small programs that need a really basic "Help" dialog with
>~ 2K to 6K of text in them.
>
>HelpDlg.frm (one TextBox):
>
>Option Explicit
>
>Private Sub Form_Load()
> Set Icon = MainUI.Icon
> txtHelp.Text = StrConv(LoadResData(101, "CUSTOM"), vbUnicode)
>End Sub
>
>Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
> If UnloadMode = vbFormControlMenu Then
> Cancel = True
> Me.Hide
> End If
>End Sub
>
>Private Sub Form_Resize()
> If WindowState <> vbMinimized Then
> txtHelp.Move 0, 0, ScaleWidth, ScaleHeight
> End If
>End Sub
>
>I'm just displaying it there, but nothing says you can't parse it into
>individual values by Splitting on vbNewLine and "," or whatever you like. I
>wouldn't bother making 88 individual resources this way though!
>
>Going to RC.exe or a 3rd party resource editing tool seems like an absurd
>complexity for things this simple. Yes Resource Editor takes some getting
>used to but most of the time you only need to make simple use of it anyway.

Thanks, I'll take a look tomorrow at these latest suggestions.
Actually, I find using rc.exe a darned sight easier (and quicker) than
using VB6's add-in resource editor. Using the rc.exe route I can edit
the string table (in a .txt file) like I'd edit any text file.

I just don't like the way the add-in works very much, that's all. Call
it personal preference. It looks to me like something half-baked, not
fully formed.

MM
From: Karl E. Peterson on
MM pretended :
> I've read Karl's article about using a .res file and LoadResData to
> store and transfer data,

Is that the old VBPJ Q&A article, where an array was loaded from a
resource file?

> but why is this better than just using a string variable?

It's not, necessarily, better. Highly situational.

That article was written in the VB4 timeframe, of course, when the
latter-day String functions hadn't yet come into play. So any sort of
Split routine would have to be hand-rolled.

And, it was really a very simple example of one way to emulate the
utility of the old READ/DATA statements. In a case where the amount of
data is low, and easily manipulated, storing it in and parsing it out
of strings may indeed be best. But if your dataset is vast and not
quickly calculated (by VB4-era time standards), then stuffing it in a
RES may be the best possible answer.

I guess that's one way to say this would quite often be a speed
optimization when you're attempting to wring that last little bit of
performance out. Not something you'd necessarily do at the testing
phase.

--
[.NET: It's About Trust!]


From: Ralph on

"Karl E. Peterson" <karl(a)exmvps.org> wrote in message
news:OxX5cQ5dKHA.4112(a)TK2MSFTNGP06.phx.gbl...
> MM pretended :
> > I've read Karl's article about using a .res file and LoadResData to
> > store and transfer data,
>
> Is that the old VBPJ Q&A article, where an array was loaded from a
> resource file?
>
> > but why is this better than just using a string variable?
>
> It's not, necessarily, better. Highly situational.
>
> That article was written in the VB4 timeframe, of course, when the
> latter-day String functions hadn't yet come into play. So any sort of
> Split routine would have to be hand-rolled.
>
> And, it was really a very simple example of one way to emulate the
> utility of the old READ/DATA statements. In a case where the amount of
> data is low, and easily manipulated, storing it in and parsing it out
> of strings may indeed be best. But if your dataset is vast and not
> quickly calculated (by VB4-era time standards), then stuffing it in a
> RES may be the best possible answer.
>
> I guess that's one way to say this would quite often be a speed
> optimization when you're attempting to wring that last little bit of
> performance out. Not something you'd necessarily do at the testing
> phase.
>

lol Code never dies!

At least yours is still useable with no embarressment. If anyone ever
connects me to my past articles - I could never show my face here again. <g>

-ralph


From: Karl E. Peterson on
Ralph explained :
> "Karl E. Peterson" <karl(a)exmvps.org> wrote in message
> news:OxX5cQ5dKHA.4112(a)TK2MSFTNGP06.phx.gbl...
>> MM pretended :
>>> I've read Karl's article about using a .res file and LoadResData to
>>> store and transfer data,
>>
>> Is that the old VBPJ Q&A article, where an array was loaded from a
>> resource file?
>>
>>> but why is this better than just using a string variable?
>>
>> It's not, necessarily, better. Highly situational.
>>
>> That article was written in the VB4 timeframe, of course, when the
>> latter-day String functions hadn't yet come into play. So any sort of
>> Split routine would have to be hand-rolled.
>>
>> And, it was really a very simple example of one way to emulate the
>> utility of the old READ/DATA statements. In a case where the amount of
>> data is low, and easily manipulated, storing it in and parsing it out
>> of strings may indeed be best. But if your dataset is vast and not
>> quickly calculated (by VB4-era time standards), then stuffing it in a
>> RES may be the best possible answer.
>>
>> I guess that's one way to say this would quite often be a speed
>> optimization when you're attempting to wring that last little bit of
>> performance out. Not something you'd necessarily do at the testing
>> phase.
>
> lol Code never dies!

Did I ever tell ya the one about loading my DBF read/write code from a
QB4 BAS file into VB6? <bg>

Turns out I misremembered, and this article is "only" 10 years old!
http://vb.mvps.org/articles/ap199912.asp

> At least yours is still useable with no embarressment. If anyone ever
> connects me to my past articles - I could never show my face here again. <g>

Well, I do *cringe* from time to time...

--
[.NET: It's About Trust!]