From: Ralph on

"Nobody" <nobody(a)nobody.com> wrote in message
news:O$dSfhodKHA.744(a)TK2MSFTNGP05.phx.gbl...
> Approximately how many characters are you talking about?
>
> To me, using a resource file is not worth it, unless it for adding
> international languages support, or embedding binary files within the EXE.
>

I would add the OP's case to the above, that is the ability to provide
literal/constants arrays.

I'm not a fan of doing it this way myself, but it does work, and alternates
are just as lacking in polish.

-ralph


From: Ralph on

"MM" <kylix_is(a)yahoo.co.uk> wrote in message
news:lthnh5985meco6163dlei7bldsfp57gpj4(a)4ax.com...
>

> .... Also, no matter how often I click on the Save button
> in the Resource Editor, when I exit VB6 I get a warning to save the
> resource file.

This unfortunately is a problem that crops up with all of VB's secondary
designers and utilities. (You can experience the same problem with DE for
example.) I hesitate to call it an out-right bug per se as I vaguely
remember reading the reason once upon a time.

It is annoying, but it is just the way it is.

-ralph


From: MM on
On Sun, 6 Dec 2009 10:27:26 -0500, "Nobody" <nobody(a)nobody.com> wrote:

>"MM" <kylix_is(a)yahoo.co.uk> wrote in message
>news:lthnh5985meco6163dlei7bldsfp57gpj4(a)4ax.com...
>> binary file. I'd be much more confident to use an external resource
>> file editor, rather than the add-in. Is there such a thing for VB6
>> .res files or is the inbuilt resource editor the only way?
>
>If you have VC6, then you can use it's resource editor. It compiles to RES
>file that you can add to your project.

Yep! Just found the rc.exe utility and this is a MUCH better approach
to using the add-in.

MM
From: MM on
On Sun, 6 Dec 2009 10:25:32 -0500, "Nobody" <nobody(a)nobody.com> wrote:

>Approximately how many characters are you talking about?

88 piano keys times 6 items of data:
- y pos of note on staff
- stem direction, up or down
- whether note has sharp or flat
- number of ledger lines
- whether ledger lines are above or below staff
- y pos of first ledger line

>To me, using a resource file is not worth it, unless it for adding
>international languages support, or embedding binary files within the EXE.

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
From: Nobody 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.

If you have Excel or equivalent, you could use it to generate VB/C++ code.
Here is an example which may look like a lot of steps, but it's really
straight forward. I used this method for generating What's This Help for
both VB and help file projects.

- Start Excel.
- In cell A1, type "TEST1"
- In cell B1, type "Some text"
- Select cells A1-A10.
- Click Edit-->Fill-->Series.
- Select AutoFill and click OK. Now cells A1-A20 are filled with "TEST1",
"TEST2", and so on.
- Click on cell B1, and then click Copy.
- Select cells B2-B10, and then click Paste. You could enter different text
in these cells if you want to.
- In cell C1, type the following and press Enter:

= "Public Const " & A1 & " = " & CHAR(34) & B1 & CHAR(34)

You will notice that cell C1 now contain:

Public Const TEST1 = "Some text"

- Click on cell C1, and then click Copy.
- Select cells C2-C10, and then click Paste.

Now cells C1-C10 contain the following:

Public Const TEST1 = "Some text"
Public Const TEST2 = "Some text"
Public Const TEST3 = "Some text"
Public Const TEST4 = "Some text"
Public Const TEST5 = "Some text"
Public Const TEST6 = "Some text"
Public Const TEST7 = "Some text"
Public Const TEST8 = "Some text"
Public Const TEST9 = "Some text"
Public Const TEST10 = "Some text"

If you have entered different text in cells B1-B10, you will see the text
you have entered. Excel uses relative cell position when copying and pasting
formulas, and adjusts the formula accordingly.

Now you can select these cells and copy them to Notepad or to your project.

You could use "#define" instead of "Public Const" above if you want to use
it in a help file project, or C++ related files. You can also use cells
D1-D10 for the C++ version(#define), so if you change one number or text,
you have VB code(In cells C1-C10) and C code(In cells D1-D10) that is
consistent.

Another thing that I used this method with is PsExec. PsExec can take an IP
address to execute some file on a remote computer by IP address(assuming
that you have permissions). In cell A1, I would enter the starting IP, and
then use AutoFill, which makes incremental IP's, then copy the result to a
batch file, delete the lines that I don't want, and run it.