Home All Groups Group Topic Archive Search About

Localized Error Messages

Author
23 Feb 2007 8:01 PM
Robert Morley
Hi all,

I'm looking into the possibility of localizing error messages coming from an
ActiveX DLL that I've designed, and I'm wondering what the best approach is.
Is there an easy way of doing this sort of thing right within the DLL (the
Resource Editor, possibly?), or am I better handling it through a
centralized source within the DLL such as re-designing my error handler to
look up message text (it's a database-oriented DLL, so other than low-level
errors prior to initialization, this would be quite feasible), or am I best
off handling this client-side and just passing error numbers?  Or something
else entirely that I haven't thought of...?

Any thoughts would be appreciated.



Thanks,
Rob

Author
23 Feb 2007 8:34 PM
Robert Morley
Further to this, while it's unlikely to make a difference that I can see, I
will only EVER have to deal with two languages (English and French).  I know
in things like Access forms, you can do tricks like using the Tag property
to store one language, while the caption holds the other, but I don't see
anything even remotely like that applying to a DLL.  Thought I'd mention it,
though, just in case there's some similar trick that had never even occurred
to me.


Rob

Show quoteHide quote
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:O1axnX4VHHA.3652@TK2MSFTNGP04.phx.gbl...
> Hi all,
>
> I'm looking into the possibility of localizing error messages coming from
> an ActiveX DLL that I've designed, and I'm wondering what the best
> approach is. Is there an easy way of doing this sort of thing right within
> the DLL (the Resource Editor, possibly?), or am I better handling it
> through a centralized source within the DLL such as re-designing my error
> handler to look up message text (it's a database-oriented DLL, so other
> than low-level errors prior to initialization, this would be quite
> feasible), or am I best off handling this client-side and just passing
> error numbers?  Or something else entirely that I haven't thought of...?
>
> Any thoughts would be appreciated.
>
>
>
> Thanks,
> Rob
>
Author
26 Feb 2007 11:40 PM
Robert Morley
So...nobody in this group has experience with localizing DLLs?!?


Rob

Show quoteHide quote
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:O1axnX4VHHA.3652@TK2MSFTNGP04.phx.gbl...
> Hi all,
>
> I'm looking into the possibility of localizing error messages coming from
> an ActiveX DLL that I've designed, and I'm wondering what the best
> approach is. Is there an easy way of doing this sort of thing right within
> the DLL (the Resource Editor, possibly?), or am I better handling it
> through a centralized source within the DLL such as re-designing my error
> handler to look up message text (it's a database-oriented DLL, so other
> than low-level errors prior to initialization, this would be quite
> feasible), or am I best off handling this client-side and just passing
> error numbers?  Or something else entirely that I haven't thought of...?
>
> Any thoughts would be appreciated.
>
>
>
> Thanks,
> Rob
>
Author
1 Mar 2007 3:09 PM
Ralph
Show quote Hide quote
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:%23wpXK%23fWHHA.4188@TK2MSFTNGP06.phx.gbl...
> So...nobody in this group has experience with localizing DLLs?!?
>
>
> Rob
>
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:O1axnX4VHHA.3652@TK2MSFTNGP04.phx.gbl...
> > Hi all,
> >
> > I'm looking into the possibility of localizing error messages coming
from
> > an ActiveX DLL that I've designed, and I'm wondering what the best
> > approach is. Is there an easy way of doing this sort of thing right
within
> > the DLL (the Resource Editor, possibly?), or am I better handling it
> > through a centralized source within the DLL such as re-designing my
error
> > handler to look up message text (it's a database-oriented DLL, so other
> > than low-level errors prior to initialization, this would be quite
> > feasible), or am I best off handling this client-side and just passing
> > error numbers?  Or something else entirely that I haven't thought of...?
> >
> > Any thoughts would be appreciated.
> >
> >
> >
> > Thanks,
> > Rob
> >
>

Part of the reason you are not getting a lot of replies is simply because
there isn't a "best approach" outside what will work best with your problem
domain and your resources. Even within your apps you will likely find you
need several different approaches.

Everything you mentioned will work. Everything you mentioned will have a
down-side under some condition. And so it will go with any scheme.

-ralph
Author
1 Mar 2007 4:30 PM
Robert Morley
That's what I was afraid someone was going to say. :)  Thanks for getting
back to me!


Rob

Show quoteHide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in message
news:2OidnSzKPa-vcXvYnZ2dnUVZ_vCknZ2d@arkansas.net...
>
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:%23wpXK%23fWHHA.4188@TK2MSFTNGP06.phx.gbl...
>> So...nobody in this group has experience with localizing DLLs?!?
>>
>>
>> Rob
>>
>> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
>> news:O1axnX4VHHA.3652@TK2MSFTNGP04.phx.gbl...
>> > Hi all,
>> >
>> > I'm looking into the possibility of localizing error messages coming
> from
>> > an ActiveX DLL that I've designed, and I'm wondering what the best
>> > approach is. Is there an easy way of doing this sort of thing right
> within
>> > the DLL (the Resource Editor, possibly?), or am I better handling it
>> > through a centralized source within the DLL such as re-designing my
> error
>> > handler to look up message text (it's a database-oriented DLL, so other
>> > than low-level errors prior to initialization, this would be quite
>> > feasible), or am I best off handling this client-side and just passing
>> > error numbers?  Or something else entirely that I haven't thought
>> > of...?
>> >
>> > Any thoughts would be appreciated.
>> >
>> >
>> >
>> > Thanks,
>> > Rob
>> >
>>
>
> Part of the reason you are not getting a lot of replies is simply because
> there isn't a "best approach" outside what will work best with your
> problem
> domain and your resources. Even within your apps you will likely find you
> need several different approaches.
>
> Everything you mentioned will work. Everything you mentioned will have a
> down-side under some condition. And so it will go with any scheme.
>
> -ralph
>
>
>
Author
1 Mar 2007 6:49 PM
Karl E. Peterson
Robert Morley <rmor***@magma.ca.N0.Freak1n.sparn> wrote:
> So...nobody in this group has experience with localizing DLLs?!?

Yeah, I'm with Ralph, I guess.  Plus, I haven't done enough (hardly any!) to have a
real opinion.  My understanding, though, is that there just aren't that many good
options.  Another thing I've picked up over the years is, Michael Kaplan is the GoTo
Guy in this area.  Might want to google his book on "internationalization".

   http://www.google.com/search?q=kaplan+i18n

--
..NET: It's About Trust!
http://vfred.mvps.org
Author
1 Mar 2007 7:03 PM
Robert Morley
Ah, yes, Michael Kaplan.  I avoid him whenever possible, as he has an
attitude that eclipses all others I've seen on any Internet forum.  And at
CDN$ 200 from Amazon, I don't think I need to read about localization that
badly.  I know the basics of the various methods, and for a user base of
about twenty people, that'll do. :)  Thanks for the idea, though.  If it
were less pricey and written by anybody else, I might've considered it.


Rob

Show quoteHide quote
"Karl E. Peterson" <k***@mvps.org> wrote in message
news:epvdLJDXHHA.1636@TK2MSFTNGP02.phx.gbl...
> Robert Morley <rmor***@magma.ca.N0.Freak1n.sparn> wrote:
>> So...nobody in this group has experience with localizing DLLs?!?
>
> Yeah, I'm with Ralph, I guess.  Plus, I haven't done enough (hardly any!)
> to have a real opinion.  My understanding, though, is that there just
> aren't that many good options.  Another thing I've picked up over the
> years is, Michael Kaplan is the GoTo Guy in this area.  Might want to
> google his book on "internationalization".
>
>   http://www.google.com/search?q=kaplan+i18n
>
> --
> .NET: It's About Trust!
> http://vfred.mvps.org
>
Author
1 Mar 2007 7:27 PM
Karl E. Peterson
Robert Morley <rmor***@magma.ca.N0.Freak1n.sparn> wrote:
> Ah, yes, Michael Kaplan.  I avoid him whenever possible, as he has an
> attitude that eclipses all others I've seen on any Internet forum.

Well, don't let it be said that I don't try!  ;-)
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
2 Mar 2007 12:11 AM
Ralph
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:eS74%23SDXHHA.4720@TK2MSFTNGP04.phx.gbl...
> Ah, yes, Michael Kaplan.  I avoid him whenever possible, as he has an
> attitude that eclipses all others I've seen on any Internet forum.  And at
> CDN$ 200 from Amazon, I don't think I need to read about localization that
> badly.  I know the basics of the various methods, and for a user base of
> about twenty people, that'll do. :)  Thanks for the idea, though.  If it
> were less pricey and written by anybody else, I might've considered it.
>
>
> Rob
>
<snipped>

LOL!

I know the feeling. Back when I was a militant OO zealot I ran across
material by another militant OO bigot - Bertrand Meyer. A really useful and
interesting slant on things. I was quite excited to learn he was coming to
town, and then I got to meet him.

I still recommend his book. I wince a bit, but I still recommend it.

You don't have to invited them to dinner, just mine their knowledge banks.

-ralph
(Mr. Meyer also helped me in another way. Having seen the mirror, I am no
longer a militant OO zeolot, just a village vicar. <g>)
Author
6 Mar 2007 11:45 AM
Tony Proctor
For simple error messages and text fragments then it's not too difficult to
use generic *.mc/*.rc files to build alternative "satellite DLLs" that can
be loaded based on your current locale. This old post describes briefly what
we do here:
http://groups.google.ie/group/microsoft.public.vb.general.discussion/msg/0c584f7d7b6cab95?hl=en&

If it's interesting, give us a shout Rob and I can add some more bits and
pieces

    Tony Proctor

Show quoteHide quote
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:O1axnX4VHHA.3652@TK2MSFTNGP04.phx.gbl...
> Hi all,
>
> I'm looking into the possibility of localizing error messages coming from
an
> ActiveX DLL that I've designed, and I'm wondering what the best approach
is.
> Is there an easy way of doing this sort of thing right within the DLL (the
> Resource Editor, possibly?), or am I better handling it through a
> centralized source within the DLL such as re-designing my error handler to
> look up message text (it's a database-oriented DLL, so other than
low-level
> errors prior to initialization, this would be quite feasible), or am I
best
> off handling this client-side and just passing error numbers?  Or
something
> else entirely that I haven't thought of...?
>
> Any thoughts would be appreciated.
>
>
>
> Thanks,
> Rob
>
>
Author
6 Mar 2007 4:46 PM
Robert Morley
I only looked at it briefly, and it looks like it might be interesting, but
it seems like it would be more trouble than using the Resource Editor, and
ultimately seems to get you to the same place.  What are the advantages to
that method?


Rob

Show quoteHide quote
"Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in message
news:%23pm9uT%23XHHA.4940@TK2MSFTNGP05.phx.gbl...
> For simple error messages and text fragments then it's not too difficult
> to
> use generic *.mc/*.rc files to build alternative "satellite DLLs" that can
> be loaded based on your current locale. This old post describes briefly
> what
> we do here:
> http://groups.google.ie/group/microsoft.public.vb.general.discussion/msg/0c584f7d7b6cab95?hl=en&
>
> If it's interesting, give us a shout Rob and I can add some more bits and
> pieces
>
>    Tony Proctor
>
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:O1axnX4VHHA.3652@TK2MSFTNGP04.phx.gbl...
>> Hi all,
>>
>> I'm looking into the possibility of localizing error messages coming from
> an
>> ActiveX DLL that I've designed, and I'm wondering what the best approach
> is.
>> Is there an easy way of doing this sort of thing right within the DLL
>> (the
>> Resource Editor, possibly?), or am I better handling it through a
>> centralized source within the DLL such as re-designing my error handler
>> to
>> look up message text (it's a database-oriented DLL, so other than
> low-level
>> errors prior to initialization, this would be quite feasible), or am I
> best
>> off handling this client-side and just passing error numbers?  Or
> something
>> else entirely that I haven't thought of...?
>>
>> Any thoughts would be appreciated.
>>
>>
>>
>> Thanks,
>> Rob
>>
>>
>
>
Author
6 Mar 2007 6:13 PM
Tony Proctor
Advantages of which bit Rob?

Satellite DLLs are recommended by MSFT over one big resource DLL that
includes all languages, or having the resource built directly into your
EXE/DLL

Having a generic set of *.mc/*.rc source files that include all languages is
better for ongoing maintenance, e.g. if a FormatMessage parameter marker is
changed, or a message/string added/deleted.

We actually use a small in-house utility that goes straight from those
*.mc/*.rc/*.h files to a set of satellite DLLs (one for each language
declared in the source files), and a set of Const definitions to import the
symbolic codes back into a VB project. This utility takes care or running
the rc/mc compilers, and the linker, and generating the Const file for us.

    Tony Proctor

Show quoteHide quote
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:%23Tjhu$AYHHA.1296@TK2MSFTNGP02.phx.gbl...
> I only looked at it briefly, and it looks like it might be interesting,
but
> it seems like it would be more trouble than using the Resource Editor, and
> ultimately seems to get you to the same place.  What are the advantages to
> that method?
>
>
> Rob
>
> "Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in
message
> news:%23pm9uT%23XHHA.4940@TK2MSFTNGP05.phx.gbl...
> > For simple error messages and text fragments then it's not too difficult
> > to
> > use generic *.mc/*.rc files to build alternative "satellite DLLs" that
can
> > be loaded based on your current locale. This old post describes briefly
> > what
> > we do here:
> >
http://groups.google.ie/group/microsoft.public.vb.general.discussion/msg/0c584f7d7b6cab95?hl=en&
Show quoteHide quote
> >
> > If it's interesting, give us a shout Rob and I can add some more bits
and
> > pieces
> >
> >    Tony Proctor
> >
> > "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> > news:O1axnX4VHHA.3652@TK2MSFTNGP04.phx.gbl...
> >> Hi all,
> >>
> >> I'm looking into the possibility of localizing error messages coming
from
> > an
> >> ActiveX DLL that I've designed, and I'm wondering what the best
approach
> > is.
> >> Is there an easy way of doing this sort of thing right within the DLL
> >> (the
> >> Resource Editor, possibly?), or am I better handling it through a
> >> centralized source within the DLL such as re-designing my error handler
> >> to
> >> look up message text (it's a database-oriented DLL, so other than
> > low-level
> >> errors prior to initialization, this would be quite feasible), or am I
> > best
> >> off handling this client-side and just passing error numbers?  Or
> > something
> >> else entirely that I haven't thought of...?
> >>
> >> Any thoughts would be appreciated.
> >>
> >>
> >>
> >> Thanks,
> >> Rob
> >>
> >>
> >
> >
>
>
Author
6 Mar 2007 6:28 PM
Robert Morley
Hi Tony,

I was looking for the advantages of your method as a whole compared to using
the Resource Editor, or just reading plain text files, or loading strings in
from a database.

In regards to the Satellite vs. one big DLL:  as I understand it, the
Resource Editor can be used to create either one monolithic DLL *or*
individual satellite DLLs (http://support.microsoft.com/kb/188659).  I'll
have a better look at your suggestion tomorrow, though, when I'm "back at
work" and can truly look at it in depth.

PS, I'm a complete newbie to localization of any kind outside of database
lookup tables, so most of your message about *.mc/*.rc source files and
FormatMessage parameters and such went right over my head.



Rob

Show quoteHide quote
"Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in message
news:%23xkQrsBYHHA.4868@TK2MSFTNGP03.phx.gbl...
> Advantages of which bit Rob?
>
> Satellite DLLs are recommended by MSFT over one big resource DLL that
> includes all languages, or having the resource built directly into your
> EXE/DLL
>
> Having a generic set of *.mc/*.rc source files that include all languages
> is
> better for ongoing maintenance, e.g. if a FormatMessage parameter marker
> is
> changed, or a message/string added/deleted.
>
> We actually use a small in-house utility that goes straight from those
> *.mc/*.rc/*.h files to a set of satellite DLLs (one for each language
> declared in the source files), and a set of Const definitions to import
> the
> symbolic codes back into a VB project. This utility takes care or running
> the rc/mc compilers, and the linker, and generating the Const file for us.
>
>    Tony Proctor
>
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:%23Tjhu$AYHHA.1296@TK2MSFTNGP02.phx.gbl...
>> I only looked at it briefly, and it looks like it might be interesting,
> but
>> it seems like it would be more trouble than using the Resource Editor,
>> and
>> ultimately seems to get you to the same place.  What are the advantages
>> to
>> that method?
>>
>>
>> Rob
>>
>> "Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in
> message
>> news:%23pm9uT%23XHHA.4940@TK2MSFTNGP05.phx.gbl...
>> > For simple error messages and text fragments then it's not too
>> > difficult
>> > to
>> > use generic *.mc/*.rc files to build alternative "satellite DLLs" that
> can
>> > be loaded based on your current locale. This old post describes briefly
>> > what
>> > we do here:
>> >
> http://groups.google.ie/group/microsoft.public.vb.general.discussion/msg/0c584f7d7b6cab95?hl=en&
>> >
>> > If it's interesting, give us a shout Rob and I can add some more bits
> and
>> > pieces
>> >
>> >    Tony Proctor
>> >
>> > "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
>> > news:O1axnX4VHHA.3652@TK2MSFTNGP04.phx.gbl...
>> >> Hi all,
>> >>
>> >> I'm looking into the possibility of localizing error messages coming
> from
>> > an
>> >> ActiveX DLL that I've designed, and I'm wondering what the best
> approach
>> > is.
>> >> Is there an easy way of doing this sort of thing right within the DLL
>> >> (the
>> >> Resource Editor, possibly?), or am I better handling it through a
>> >> centralized source within the DLL such as re-designing my error
>> >> handler
>> >> to
>> >> look up message text (it's a database-oriented DLL, so other than
>> > low-level
>> >> errors prior to initialization, this would be quite feasible), or am I
>> > best
>> >> off handling this client-side and just passing error numbers?  Or
>> > something
>> >> else entirely that I haven't thought of...?
>> >>
>> >> Any thoughts would be appreciated.
>> >>
>> >>
>> >>
>> >> Thanks,
>> >> Rob
>> >>
>> >>
>> >
>> >
>>
>>
>
>
Author
6 Mar 2007 7:24 PM
Tony Proctor
The FormatMessage API is like a system version of printf(), if that means
anything :-) In other words, it allows parameters to be formatted into a
message template. For instance:
http://groups.google.ie/group/microsoft.public.vb.general.discussion/msg/849062dae6948989?hl=en&

One problem with using the resource editor on its own is ensuring that the
numeric codes used by your VB match the MESSAGE and STRING table entries in
the resource file. If not then you'll either get some type of 'not found'
error, or an Access Violation when trying to format a parameter into what
you thought was a valid template. In our system, the *.rc/*.mc source files
can be sent off to an agency for translation into different languages. On
return, our in-house utility compiles them to generate multiple satellite
DLLs, plus a *.mod file containing the necessary Const symbols for our code
to compile against.

    Tony Proctor


Show quoteHide quote
"Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
news:O1hKl2BYHHA.1216@TK2MSFTNGP03.phx.gbl...
> Hi Tony,
>
> I was looking for the advantages of your method as a whole compared to
using
> the Resource Editor, or just reading plain text files, or loading strings
in
> from a database.
>
> In regards to the Satellite vs. one big DLL:  as I understand it, the
> Resource Editor can be used to create either one monolithic DLL *or*
> individual satellite DLLs (http://support.microsoft.com/kb/188659).  I'll
> have a better look at your suggestion tomorrow, though, when I'm "back at
> work" and can truly look at it in depth.
>
> PS, I'm a complete newbie to localization of any kind outside of database
> lookup tables, so most of your message about *.mc/*.rc source files and
> FormatMessage parameters and such went right over my head.
>
>
>
> Rob
>
> "Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in
message
> news:%23xkQrsBYHHA.4868@TK2MSFTNGP03.phx.gbl...
> > Advantages of which bit Rob?
> >
> > Satellite DLLs are recommended by MSFT over one big resource DLL that
> > includes all languages, or having the resource built directly into your
> > EXE/DLL
> >
> > Having a generic set of *.mc/*.rc source files that include all
languages
> > is
> > better for ongoing maintenance, e.g. if a FormatMessage parameter marker
> > is
> > changed, or a message/string added/deleted.
> >
> > We actually use a small in-house utility that goes straight from those
> > *.mc/*.rc/*.h files to a set of satellite DLLs (one for each language
> > declared in the source files), and a set of Const definitions to import
> > the
> > symbolic codes back into a VB project. This utility takes care or
running
> > the rc/mc compilers, and the linker, and generating the Const file for
us.
> >
> >    Tony Proctor
> >
> > "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> > news:%23Tjhu$AYHHA.1296@TK2MSFTNGP02.phx.gbl...
> >> I only looked at it briefly, and it looks like it might be interesting,
> > but
> >> it seems like it would be more trouble than using the Resource Editor,
> >> and
> >> ultimately seems to get you to the same place.  What are the advantages
> >> to
> >> that method?
> >>
> >>
> >> Rob
> >>
> >> "Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in
> > message
> >> news:%23pm9uT%23XHHA.4940@TK2MSFTNGP05.phx.gbl...
> >> > For simple error messages and text fragments then it's not too
> >> > difficult
> >> > to
> >> > use generic *.mc/*.rc files to build alternative "satellite DLLs"
that
> > can
> >> > be loaded based on your current locale. This old post describes
briefly
> >> > what
> >> > we do here:
> >> >
> >
http://groups.google.ie/group/microsoft.public.vb.general.discussion/msg/0c584f7d7b6cab95?hl=en&
Show quoteHide quote
> >> >
> >> > If it's interesting, give us a shout Rob and I can add some more bits
> > and
> >> > pieces
> >> >
> >> >    Tony Proctor
> >> >
> >> > "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> >> > news:O1axnX4VHHA.3652@TK2MSFTNGP04.phx.gbl...
> >> >> Hi all,
> >> >>
> >> >> I'm looking into the possibility of localizing error messages coming
> > from
> >> > an
> >> >> ActiveX DLL that I've designed, and I'm wondering what the best
> > approach
> >> > is.
> >> >> Is there an easy way of doing this sort of thing right within the
DLL
> >> >> (the
> >> >> Resource Editor, possibly?), or am I better handling it through a
> >> >> centralized source within the DLL such as re-designing my error
> >> >> handler
> >> >> to
> >> >> look up message text (it's a database-oriented DLL, so other than
> >> > low-level
> >> >> errors prior to initialization, this would be quite feasible), or am
I
> >> > best
> >> >> off handling this client-side and just passing error numbers?  Or
> >> > something
> >> >> else entirely that I haven't thought of...?
> >> >>
> >> >> Any thoughts would be appreciated.
> >> >>
> >> >>
> >> >>
> >> >> Thanks,
> >> >> Rob
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>
Author
6 Mar 2007 8:29 PM
Robert Morley
I've actually used FormatMessage in my code in a few places, but so far,
it's been mostly...I know there's a word for it, but I'm working on too
little sleep to remember it...anyway, it's basically been a matter of "get
error message from system, send it off to Format Message, display
results"...wrote the code once, maybe tweaked it a bit, never looked at it
again. :)

And yes, I know what printf() is, although only barely...last time I wrote
something in C was about 15 years ago, though of course, I've waded through
more than enough C examples to convert to VB over the years.

Anyway, I'm gonna stop reading NGs now, honest, and I'll come back to this
thread (and the code) tomorrow. :)



Rob

Show quoteHide quote
"Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in message
news:uQ8AQUCYHHA.1296@TK2MSFTNGP02.phx.gbl...
> The FormatMessage API is like a system version of printf(), if that means
> anything :-) In other words, it allows parameters to be formatted into a
> message template. For instance:
> http://groups.google.ie/group/microsoft.public.vb.general.discussion/msg/849062dae6948989?hl=en&
>
> One problem with using the resource editor on its own is ensuring that the
> numeric codes used by your VB match the MESSAGE and STRING table entries
> in
> the resource file. If not then you'll either get some type of 'not found'
> error, or an Access Violation when trying to format a parameter into what
> you thought was a valid template. In our system, the *.rc/*.mc source
> files
> can be sent off to an agency for translation into different languages. On
> return, our in-house utility compiles them to generate multiple satellite
> DLLs, plus a *.mod file containing the necessary Const symbols for our
> code
> to compile against.
>
>    Tony Proctor
>
>
> "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
> news:O1hKl2BYHHA.1216@TK2MSFTNGP03.phx.gbl...
>> Hi Tony,
>>
>> I was looking for the advantages of your method as a whole compared to
> using
>> the Resource Editor, or just reading plain text files, or loading strings
> in
>> from a database.
>>
>> In regards to the Satellite vs. one big DLL:  as I understand it, the
>> Resource Editor can be used to create either one monolithic DLL *or*
>> individual satellite DLLs (http://support.microsoft.com/kb/188659).  I'll
>> have a better look at your suggestion tomorrow, though, when I'm "back at
>> work" and can truly look at it in depth.
>>
>> PS, I'm a complete newbie to localization of any kind outside of database
>> lookup tables, so most of your message about *.mc/*.rc source files and
>> FormatMessage parameters and such went right over my head.
>>
>>
>>
>> Rob
>>
>> "Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in
> message
>> news:%23xkQrsBYHHA.4868@TK2MSFTNGP03.phx.gbl...
>> > Advantages of which bit Rob?
>> >
>> > Satellite DLLs are recommended by MSFT over one big resource DLL that
>> > includes all languages, or having the resource built directly into your
>> > EXE/DLL
>> >
>> > Having a generic set of *.mc/*.rc source files that include all
> languages
>> > is
>> > better for ongoing maintenance, e.g. if a FormatMessage parameter
>> > marker
>> > is
>> > changed, or a message/string added/deleted.
>> >
>> > We actually use a small in-house utility that goes straight from those
>> > *.mc/*.rc/*.h files to a set of satellite DLLs (one for each language
>> > declared in the source files), and a set of Const definitions to import
>> > the
>> > symbolic codes back into a VB project. This utility takes care or
> running
>> > the rc/mc compilers, and the linker, and generating the Const file for
> us.
>> >
>> >    Tony Proctor
>> >
>> > "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
>> > news:%23Tjhu$AYHHA.1296@TK2MSFTNGP02.phx.gbl...
>> >> I only looked at it briefly, and it looks like it might be
>> >> interesting,
>> > but
>> >> it seems like it would be more trouble than using the Resource Editor,
>> >> and
>> >> ultimately seems to get you to the same place.  What are the
>> >> advantages
>> >> to
>> >> that method?
>> >>
>> >>
>> >> Rob
>> >>
>> >> "Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in
>> > message
>> >> news:%23pm9uT%23XHHA.4940@TK2MSFTNGP05.phx.gbl...
>> >> > For simple error messages and text fragments then it's not too
>> >> > difficult
>> >> > to
>> >> > use generic *.mc/*.rc files to build alternative "satellite DLLs"
> that
>> > can
>> >> > be loaded based on your current locale. This old post describes
> briefly
>> >> > what
>> >> > we do here:
>> >> >
>> >
> http://groups.google.ie/group/microsoft.public.vb.general.discussion/msg/0c584f7d7b6cab95?hl=en&
>> >> >
>> >> > If it's interesting, give us a shout Rob and I can add some more
>> >> > bits
>> > and
>> >> > pieces
>> >> >
>> >> >    Tony Proctor
>> >> >
>> >> > "Robert Morley" <rmor***@magma.ca.N0.Freak1n.sparn> wrote in message
>> >> > news:O1axnX4VHHA.3652@TK2MSFTNGP04.phx.gbl...
>> >> >> Hi all,
>> >> >>
>> >> >> I'm looking into the possibility of localizing error messages
>> >> >> coming
>> > from
>> >> > an
>> >> >> ActiveX DLL that I've designed, and I'm wondering what the best
>> > approach
>> >> > is.
>> >> >> Is there an easy way of doing this sort of thing right within the
> DLL
>> >> >> (the
>> >> >> Resource Editor, possibly?), or am I better handling it through a
>> >> >> centralized source within the DLL such as re-designing my error
>> >> >> handler
>> >> >> to
>> >> >> look up message text (it's a database-oriented DLL, so other than
>> >> > low-level
>> >> >> errors prior to initialization, this would be quite feasible), or
>> >> >> am
> I
>> >> > best
>> >> >> off handling this client-side and just passing error numbers?  Or
>> >> > something
>> >> >> else entirely that I haven't thought of...?
>> >> >>
>> >> >> Any thoughts would be appreciated.
>> >> >>
>> >> >>
>> >> >>
>> >> >> Thanks,
>> >> >> Rob
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>