HRSRC hResource = FindResource(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDR_CALC), TEXT("MYFILE"));
if(hResource)
{
HGLOBAL hg = LoadResource(GetModuleHandle(NULL), hResource);
if(hg)
{
LPVOID pData = LockResource(hg);
if(pData)
{
DWORD dwSize = SizeofResource(GetModuleHandle(NULL), hResource);
CFile calcFile;
if(calcFile.Open("c://calc.exe", CFile::modeCreate | CFile::modeReadWrite))
{
calcFile.Write(pData, dwSize);
calcFile.Close();
}
}
}
}