주석으로 간단히 말합니다. Bitmap :: FromFile을 사용하여 파일에서 비트 맵을로드하지만 이후에 삭제하려고합니다. 디스크에서.
문제는 비트 맵 :: FROMFILE 절대적으로 변경에서 파일을 잠금입니다 /로드 된 이미지가 나는 바이너리 파일의 비트 맵을 저장하고있어 때문이다, 그래서 그것을 수행 할C++ GDI + 파일에서 이미지를로드 한 다음 파일을 삭제하기 전에 * 이미지를 언로드하기 전에
을 언로드 될 때까지 삭제 이 순서 :
1. 추출 이진 파일에서 이미지
2.로드 이미지가
3. #에서 추출 된 파일을 삭제 한
(내 이미지 리소스에 대한 단지 몇 가지 기본적인 보호, 난 그냥 그들을 원하지 않는 내 프로그램 디렉토리에 있음)
Bitmap :: FromFile이 파일을 계속 잠근다 fr 내 시도에 같은 파일에서로드 된 이미지를 복제, 심지어 톰 삭제 :
Bitmap* tempbmp = Bitmap::FromFile(fileanddir.c_str(),false);
Rect temprect(0, 0, tempbmp->GetWidth(), tempbmp->GetHeight());
// make the image to be used as a clone to the temporary
// bitmap to avoid file locking
image_to_be_used = tempbmp->Clone(temprect, PixelFormatDontCare);
// delete temporary loaded bitmap since it shouldn't be needed
delete tempbmp;
// delete the file itself, too bad the file is locked
int theresult = remove(tocharptr(fileanddir));
// returns -1, also: manually deleting at this point gives the error
// that the file is being used by another person/program
내가 비트 맵을로드 할 수 또는 파일 자체가 고정되지 않을 것이다, 그래서 어떻게 든 메모리에 복사하는 방법을 어떤 생각?
(로드 후 잠시 삭제할 수 있습니다.)
감사 할 수 있습니다! 작동하도록했습니다. 답변을 수락했습니다. – BNelsey