在DLL里使用图片资源文件出问题了
zjsyw 2005-10-20 09:14:26 我在做一个软件的时候有几个图片资源(bmp)放在程序里用下面的get_picture()运行很正常,但是图片太大了,于是我想放到DLL里(dll源程序如下),可是编译过了,调用DLL里的get_picture函数却在 bitmap->LoadFromResourceName((int)HInstance,"SRC1");//这里停住了,下面一句不执行了。哪位朋友帮我看看
//---------------------------------------------------------------------------
#include <windows.h>
#include <jpeg.hpp>
//---------------------------------------------------------------------------
// Important note about DLL memory management when your DLL uses the
// static version of the RunTime Library:
//
// If your DLL exports any functions that pass String objects (or structs/
// classes containing nested Strings) as parameter or function results,
// you will need to add the library MEMMGR.LIB to both the DLL project and
// any other projects that use the DLL. You will also need to use MEMMGR.LIB
// if any other projects which use the DLL will be performing new or delete
// operations on any non-TObject-derived classes which are exported from the
// DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
// EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
// the file BORLNDMM.DLL should be deployed along with your DLL.
//
// To avoid using BORLNDMM.DLL, pass string information using "char *" or
// ShortString parameters.
//
// If your DLL uses the dynamic version of the RTL, you do not need to
// explicitly add MEMMGR.LIB as this will be done implicitly for you
//---------------------------------------------------------------------------
#pragma argsused
#pragma resource "source.res" //这是我的资源文件
extern "C" __declspec(dllexport) void __stdcall get_picture();
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
void __stdcall get_picture()
{
Graphics::TBitmap *bitmap=new Graphics::TBitmap;
bitmap->LoadFromResourceName((int)HInstance,"SRC1");//这里停住了
bitmap->SaveToFile("c:\\xy_temp.bmp");
delete bitmap;
}