댓글 쓰기 권한이 없습니다. 로그인 하시겠습니까?
|
MFC
2010.11.01 16:40
프로젝트 Resource에서 파일로 저장하는 방법
조회 수 55370 댓글 0
//-------------------------------------------------------------
// 프로젝트 Resource에서 파일로 저장
//-------------------------------------------------------------
BOOL mu_MakeResource2File(CString strFilename, UINT uIDResource, LPCTSTR lpResourceType)
{
HINSTANCE hInstance = AfxGetInstanceHandle();
HRSRC hRsrc = FindResource(hInstance, MAKEINTRESOURCE(uIDResource), lpResourceType);
if (hRsrc == NULL) return FALSE;
HANDLE hRes = LoadResource(hInstance, hRsrc);
if (hRes == NULL) return FALSE;
LPSTR lpRes = (LPSTR)LockResource(hRes);
if (lpRes == NULL) return FALSE;
CFile file;
if (!file.Open(strFilename, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary|CFile::shareDenyNone))
return FALSE;
file.Write(lpRes, SizeofResource(hInstance, hRsrc));
file.Close();
//UnlockResource(hRes);
return TRUE;
}
Dreamy의 코드 스크랩내가 모으고 내가 보는
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Designed by sketchbooks.co.kr / sketchbook5 board skin
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5