【发布时间】:2012-09-24 06:54:55
【问题描述】:
我已经基于类 TCustomControl 派生了我自己的组件。我需要嵌入到以 .png 格式存储的组件位图资源中。我将以下内容添加到项目文件 resources.rc 中:
AP_LOGO RCDATA .\AP_logo_RGB_transparent.png
编译成功。组件静态链接到项目。当我运行应用程序时,它会在尝试访问嵌入式资源时引发以下错误:
Project raised exception class EResNotFound with message 'Resource AP_LOGO not found'.
源代码访问位图资源中的以下几行:
Graphics::TBitmap *bmp = new Graphics::TBitmap();
HINST handle = FindClassHInstance(__classid(TVctDiag2));
bmp->LoadFromResourceName(handle, L"AP_LOGO"); // <----- exception apppers there
当我使用资源编辑器打开可执行文件时,没有任何名为“AP_LOGO”的资源。为什么?
【问题讨论】:
标签: embedded-resource custom-component c++builder-xe2