dll中的资源 [英] Resource in a dll

查看:85
本文介绍了dll中的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个应用程序在编译为可执行文件时工作正常。


但是它被设计成一个插件同时,通过编译它作为一个dll
。编译为DLL时,我遇到资源问题。

错误总是说没有名为

" TESTNS.Toolbar.resources"的资源文件。 - 但它确实存在。链接器中是否存在巨大的

差异,产生关于

资源的dll或可执行文件?我认为它是关于命名空间的东西,这可能吗?


感谢您的帮助,


Martin

Hi,

I have an application that works fine when compiled as an executable.

But it is designed to be a plugin also at the same time, by compiling it
as a dll. I have a problem with resources when compiled as DLL. The
error always says there is no resource file named
"TESTNS.Toolbar.resources" - but it is definetly there. Is there a huge
difference in the linker producing a dll or an executable concerning
resources?? I assume it is something about the namespace, is this possible?

Thanks for your help,

Martin

推荐答案

嗨Martin,
Hi Martin,
编译为DLL时,我遇到资源问题。错误总是
表示没有名为TESTNS.Toolbar.resources的资源文件。 - 但肯定是在那里
I have a problem with resources when compiled as DLL. The error always says there is no resource file named "TESTNS.Toolbar.resources" - but it is
definetly there.




是TESTNS.Toolbar.resources吗?汇编资源文件?

您的意思是它仍然列在项目的解决方案资源管理器窗口中吗?


如果是这样,请先删除它然后再添加它(通过使用添加

已存在的项目...)?

谢谢!


Best问候,


Gary Chang

微软在线合作伙伴支持


安全! - www.microsoft.com/security

此帖子原样是按原样提供的。没有保证,也没有赋予任何权利。

--------------------



Is the "TESTNS.Toolbar.resources" an assembly resource file?
Do you mean it is still listed in the project''s solution explorer window?

If so, how about remove it firstly then add it again(by using "Adding
Existed Items...")?
Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------


嗨Gary,
Hi Gary,
是TESTNS.Toolbar.resources吗?汇编资源文件?
您的意思是它仍然列在项目的解决方案资源管理器窗口中吗?
不,它是一个.resx-File(包含图标),它位于VC.NET

项目中。

错误我的意思是抛出异常,当应用程序加载

作为plughost内的插件。执行时没有错误,并且将
编译为exe文件。如果我明确地将资源文件链接到项目中,那么例外甚至会发生,并且此时我完全混淆了

,关于发生了什么...


这个问题可能是其中一个问题吗?


系统::全球化:: CultureInfo * ci =

System :: Threading :: Thread :: CurrentThread-> CurrentCulture;


//这是编译为dll时应用程序崩溃的点

System :: Resources :: ResourceManager * tbMan =

new System :: Resources :: ResourceManager(S" TESTNS.Toolba r",asmTESTNS);


//对于所有包含的图标,这发生了18次

imgLToolBar-> Images-> Add(static_cast< System :: Drawing :: Icon *>(tbMan-> GetObject(S") ;人们)));

如果是这样,如何首先删除它然后再添加它(通过使用添加
存在的项目......)?
Is the "TESTNS.Toolbar.resources" an assembly resource file?
Do you mean it is still listed in the project''s solution explorer window? No, it is a .resx-File(containing icons) which resides in the VC.NET
project.
By error I meant an exception is thrown, when the application is loaded
as a plugin inside the plughost. There is no error if executed and
compiled as an exe-file. The exception even occures if I explicitely
link the resource-file into the project, and at this point I got
completely confused, about what is going on...

Is the problem maybe in one of this lines??

System::Globalization::CultureInfo* ci =
System::Threading::Thread::CurrentThread->CurrentCulture;

//this is the point where the application crashes when compiled as dll
System::Resources::ResourceManager *tbMan =
new System::Resources::ResourceManager(S"TESTNS.Toolba r", asmTESTNS);

//This happens 18 times for all the Icons included
imgLToolBar->Images->Add(static_cast<System::Drawing::Icon*>(tbMan->GetObject(S"People")));
If so, how about remove it firstly then add it again(by using "Adding
Existed Items...")?



已经尝试过这个。我和VS一起工作了6年。 - 我已经习惯了b $ b安静的一些怪异行为....


Already tried this one. I''m working with VS for 6 yrs. - I''m used to
quiet some freaky behaviour....


嗨马丁,


感谢您的详细信息,我们将对此问题进行一些调查,并尽快回复您。

感谢您的理解!


祝你好运,

Gary Chang

微软在线合作伙伴支持


获取安全! - www.microsoft.com/security

此帖子原样是按原样提供的。没有保证,也没有赋予任何权利。

--------------------

Hi Martin,

Thanks for your detail information, we will perform some investigation on
this problem and reply you as soon as possible.
Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------


这篇关于dll中的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆