Searching \ for '[OT]: MS-VC6 - Resource Inclusion Question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/index.htm?key=vc6+resource+inclusion
Search entire site for: 'MS-VC6 - Resource Inclusion Question'.

Exact match. Not showing close matches.
PICList Thread
'[OT]: MS-VC6 - Resource Inclusion Question'
2001\02\16@135644 by Mitch Miller

picon face
> Is it possible to have resources in a project that are linked in at build
> time but not manually added to every project they are used in (i.e. kept
in
> a Static Library or with a separate Class/File-that is linked at build
> time)?

Sure ... one way I recently did this was to create a static library out of
the resource code, then make that project a dependency of the other projects
I was working on (all five projects were in the same project workspace).  VC
then automatically links in the code from the library as needed.  Another
way would be to make the resource code into a .DLL, which would then get
linked in at run-time, rather than compile/link time.  The beauty of this is
that if the source code in the library changes, VC automatically detects
this, and builds the library before building the other projects, and links
in the updated library to the project being built.

One final option, if you're not comfortable with libraries, etc. is to
simply include the source file in your list of files in the Project
Explorer.  The file doesn't have to be in the same folder as your project.
From your VC project, just select Project / Add To project / Files and add
whatever files you want from anywhere on your hard drive.  It can be an .RC
file, or a source file, etc.

Hope that helps.

-- Mitch

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\02\16@142753 by Bourdon, Bruce

flavicon
face
Mitch:

I am very comfortable with libs (write static/dynamic libs and VxDs and
Drivers).

I have modified the project to be a dependency of the resource static
library, as you suggested (and now the main executable project rebuilds
automatically whenever the static library is modified as you mentioned).

But this still leaves me unable to access the resources - either from the
static lib and from the executable that dependant on it.

I've tried LoadImage(), LoadBitmap() both inside and executable and within
an added helper function in the lib - no success. Always returns a NULL
handle.

If the same bitmap is placed in the resources of the main file (executable)
it works fine.

Bottom line is this (so far):
* bitmap listed as a resource of the static lib: does not load.
* bitmap listed as a resource of the main executable: always loads fine.

The above two are true whether the load attempt is made in the main exe. or
the static lib.

Thoughts?
Bruce.

{Original Message removed}

2001\02\16@161056 by Scott Newell

flavicon
face
>Bottom line is this (so far):
> * bitmap listed as a resource of the static lib: does not load.
> * bitmap listed as a resource of the main executable: always loads fine.
>
>The above two are true whether the load attempt is made in the main exe. or
>the static lib.
>
>Thoughts?

Is the linker discarding the resources from the static library since they
appear to be unreferenced?  Might want to examine the executable and check
to see that the resources are present.


newell

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\02\16@182749 by Bob Ammerman

picon face
Um,

I think you build a RES file from the RC file, then include the RES file in
the primary project.

But I could be wrong.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2001\02\20@164205 by Bourdon, Bruce

flavicon
face
Ok Bob:

I give; I've got egg all over my face - but I didn't know you could do this.

I've messed around a bit today, after reading your post, and am only having
partial success.

The bitmaps are definately being added to the executable now (I view the hex
contents and can "see" them).

However I cannot access them via the LoadBitmap() funtion unless the bitmap
is dragged from the resource file to the projects main resource file, which
defeats the whole purpose for this (previous attempts with LoadImage also
failed).

I've been searching through the docs I have available and haven't seen
anything clear cut yet. You mentioned building (compiling) an res file from
the rc file and then including that in the primary project - this had the
effect mentioned above.
Similar references suggested using rc.exe to complile the rc to an res and
then use cvtres to convert it to an obj and then link it in... I've tried
these and others without success.

If you would like to send your thoughts without further cluttering of the
piclist with this topic, my email is below (I've searched for yours over
many of your posts but never found it included).

Thanks for the previous post.
Bruce.
spam_OUTbbourdonTakeThisOuTspamzydacron.com

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...