|
class A { // 클래스선언
public:
__fastcall A(TComponent); // 생성자
__fastcall ~A(); // 소멸자
void __fastcall SetVolumeMeter( int Vol );
private:
TImage *imgVolumeLevel;
TImageList *imgVolumeList;
Graphics::TBitmap *tempBMP; // 임시저장소 할당
};
// 맴버함수 정의
__fastcall A::A(TComponent* Owner)
:TForm(Owner)
{
tempBMP = new Graphics::TBitmap;
}
__fastcall A::~A()
{
if( tempBMP)
{
delete tempBMP;
}
tempBMP = NULL;
}
void __fastcall A::SetVolumeMeter( int Vol )
{
// tempBMP->FreeImage();
imgVolumeList->GetBitmap( Vol, tempBMP );
imgVolumeLevel->Picture->Assign(tempBMP);
}
SetVolumeMeter() 메소드 보시면 리스트에서 해당하는 이미지를 tempBMP에다가
임시 저장시킨다음 imgVolumeLevel에다가 이미지를 다시 Assign() 시키고있습니다.
근데 좀 사용하다 보면
Project main.exe raised exception class EOutOfResources with message 'Out of system resources'.
이란 경고창이 나오면서 프로그램이 죽어버립니다...
더욱 제가 궁금한것은 tempBMP->FreeImage();를 넣어주면 프로그램이 1분정도 더 오래살고
빼면 프로그램 시작하자마자 정말 빨리죽는데요
참고로 SetVolumeMeter는 호출빈도수가 상당히 높습니다
혹시 제가 뭔가 잘못하고 있는건지 궁금합니다
|