Resources in MC++

J

jlea

I'm currently using icons in my app via external files
(pImageList->Images->Add(new Icon("Empty.ico"))) and I need to switch to
using them by compiling them into the assembly and using (Object* aa =
rsrcMgr->GetObject(S"Empty.ico")). I used one of the several applications
from the internet that allow you to insert files such as *.ico files into
the resx file and that seemed to work. However, I'm not having too much luck
accessing the icon since I'm getting a "MissingManifestResouceException"
error when I try to access the resource. I get the same error when I try to
access one of the strings in the resx file.

My little test application consists of a main exe and a single assembly dll
(again, both MC++). I'm trying to access the icon from code contained in the
dll assembly using the following code (the name of the .resource file is
"DAL_ProjectTree"):

namespace LeapSoft {

namespace DAL {

DAL_ProjectTree::DAL_ProjectTree(IDAL* pDAL)

{

String* name = CultureInfo::CurrentCulture->Name;

CultureInfo* c = new CultureInfo(name, false);

Thread::CurrentThread->CurrentCulture = c;

ResourceManager* rsrcMgr = new ResourceManager("DAL_ProjecTree",
Assembly::GetExecutingAssembly());

String* aa = rsrcMgr->GetString(S"abc");

}

}



Do I to worry about the namespace (I also tried not using a namespace with
no luck) or something else? I downloaded the recent MC++ samples from msdn
and the one on Localization has a manifest resouce inside an .rc file. Do I
need to do the same? I removed that resource from the sample and it still
worked so I'm inclined to think not. Do I need to do something with the
resources in the exe?

Any help will be appreciated?

Jon Lea.
 
J

jlea

Some additional informastion: if I put the same code that I'm using in the
class that is part of the dll assembly into one of the classes in the exe
assembly, I can get the string resource. It looks like there is something
that I need to do to get resources contained in a dll assembly.

Jon Lea
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top