Use of Resource file versus embedding a resource 
Author Message
 Use of Resource file versus embedding a resource

I am not sure if this question is best addressed in the IDE newsgroup but
I'll try here first. I have been using custom cursors by loading the files
directly for convenience sake. I realize there will be issues down the road
with doing this. While I was looking for how to handle this properly in the
MSDN literature I ran across "Resource files" and "Embedded Resources".

I just got through the process of re-creating the cursors as Resources and
changing the "Build Action" to "Embedded Resource". Using the cursors in
code was easy. My meager understanding of what I just did with this exercise
is to assure that these cursors will be embedded in the application's
executable and I will not have to worry about them later on if I share the
application with others.

Am I correct in my understanding?

The "Resource File" approach, although applicable to my situation, was more
heavily slanted towards "Globalization" issues in the literature. I created
a Resource File and added cursors to it as resources but got pretty tangled
up in trying to access the cursors in code so I gave up. The embedded
cursors work so I'm happy.

If my assumption above is correct, my experience thus far indicates that if
I only need to use a few cursors, icons, and/or bitmaps in my apps as
resources, I'm better off embedding them?

When would I need to consider using a Resource File?

TIA



Sat, 30 Apr 2005 23:25:14 GMT  
 Use of Resource file versus embedding a resource
Aha!

So the resource file is needed when some aspect of a resource may/may not
have the intended meaning in a different culture or country. The resource
file enables the programmer to "localize" it's meaning...

I don't think I'll ever get to the level of worldwide fame as a programmer
so I won't worry about it, but it is good to know.

Thanks



Quote:
> Gerry,

>     You are exactly right.  If you are going to use resource files, then
you
> should use localizable resources here (like prompts, bits of text, etc,
> etc).  However, in your case, you are using some bitmaps, a cursor, etc,
> etc, and typically, these are usually not localizable.

>     Of course, if your cursor is dependent on the locale (say, it turns
into
> a different flag for different regions), then you could use external
> resource files. =)

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET/C# MVP]



> > I am not sure if this question is best addressed in the IDE newsgroup
but
> > I'll try here first. I have been using custom cursors by loading the
files
> > directly for convenience sake. I realize there will be issues down the
> road
> > with doing this. While I was looking for how to handle this properly in
> the
> > MSDN literature I ran across "Resource files" and "Embedded Resources".

> > I just got through the process of re-creating the cursors as Resources
and
> > changing the "Build Action" to "Embedded Resource". Using the cursors in
> > code was easy. My meager understanding of what I just did with this
> exercise
> > is to assure that these cursors will be embedded in the application's
> > executable and I will not have to worry about them later on if I share
the
> > application with others.

> > Am I correct in my understanding?

> > The "Resource File" approach, although applicable to my situation, was
> more
> > heavily slanted towards "Globalization" issues in the literature. I
> created
> > a Resource File and added cursors to it as resources but got pretty
> tangled
> > up in trying to access the cursors in code so I gave up. The embedded
> > cursors work so I'm happy.

> > If my assumption above is correct, my experience thus far indicates that
> if
> > I only need to use a few cursors, icons, and/or bitmaps in my apps as
> > resources, I'm better off embedding them?

> > When would I need to consider using a Resource File?

> > TIA



Sat, 30 Apr 2005 23:49:03 GMT  
 Use of Resource file versus embedding a resource
Actually the preferred way of localizing is to add everything as a resource,
and allow the runtime's ResourceManager to load the correct resource for the
given locale.  This is done by putting the default (or locale neutral)
resources in your assembly, and then creating "Satellite Assemblies" that
are basically assemblies with nothing more than embedded localized
resources.  At runtime the ResourceManager will locate and load the
appropriate satellite assembly if available otherwise it will gracefully
fall-back to the default resources in your main assembly.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Aha!

> So the resource file is needed when some aspect of a resource may/may not
> have the intended meaning in a different culture or country. The resource
> file enables the programmer to "localize" it's meaning...

> I don't think I'll ever get to the level of worldwide fame as a programmer
> so I won't worry about it, but it is good to know.

> Thanks


wrote

> > Gerry,

> >     You are exactly right.  If you are going to use resource files, then
> you
> > should use localizable resources here (like prompts, bits of text, etc,
> > etc).  However, in your case, you are using some bitmaps, a cursor, etc,
> > etc, and typically, these are usually not localizable.

> >     Of course, if your cursor is dependent on the locale (say, it turns
> into
> > a different flag for different regions), then you could use external
> > resource files. =)

> >     Hope this helps.

> > --
> >                - Nicholas Paldino [.NET/C# MVP]



> > > I am not sure if this question is best addressed in the IDE newsgroup
> but
> > > I'll try here first. I have been using custom cursors by loading the
> files
> > > directly for convenience sake. I realize there will be issues down the
> > road
> > > with doing this. While I was looking for how to handle this properly
in
> > the
> > > MSDN literature I ran across "Resource files" and "Embedded
Resources".

> > > I just got through the process of re-creating the cursors as Resources
> and
> > > changing the "Build Action" to "Embedded Resource". Using the cursors
in
> > > code was easy. My meager understanding of what I just did with this
> > exercise
> > > is to assure that these cursors will be embedded in the application's
> > > executable and I will not have to worry about them later on if I share
> the
> > > application with others.

> > > Am I correct in my understanding?

> > > The "Resource File" approach, although applicable to my situation, was
> > more
> > > heavily slanted towards "Globalization" issues in the literature. I
> > created
> > > a Resource File and added cursors to it as resources but got pretty
> > tangled
> > > up in trying to access the cursors in code so I gave up. The embedded
> > > cursors work so I'm happy.

> > > If my assumption above is correct, my experience thus far indicates
that
> > if
> > > I only need to use a few cursors, icons, and/or bitmaps in my apps as
> > > resources, I'm better off embedding them?

> > > When would I need to consider using a Resource File?

> > > TIA



Sun, 01 May 2005 02:13:43 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using Embedded Resources

2. Help needed with embedded resource files

3. Retrieving a text file as an embedded resource.

4. Playing a Wav file from a embedded resource

5. How to find out amount of free resources (gdi resources, handles, system resources)

6. Still a problem with resource .rc files resource identifier

7. Open a binary file as a resource with resource ID

8. Howto: Split mfc resources across multiple resource files?

9. Using Resource .RES files to stick .bmp's and .wav files into .exe

10. resource size versus screeen resolution

11. How to add image into resource file using VS.NET

12. using resource files in static library routines

 

 
Powered by phpBB® Forum Software