// TODO: Add your control notification handler code here
CFileDialog cfg(TRUE,".exe",NULL,OFN_FILEMUSTEXIST | OFN_HIDEREADONLY,"Executable Files (*.exe)|*.exe|All Files(*.*)|*.*||",this,0);
if (cfg.DoModal() == IDOK)
{
BYTE *pData;
DWORD dwSize;
CFile file;
if (file.Open(cfg.GetPathName(),CFile::typeBinary)){
dwSize = (DWORD)file.GetLength();
pData = (BYTE *)malloc(dwSize);
if (pData == NULL)return;
file.Read(pData,dwSize);
file.Close();
CFileDialog cfgSave(FALSE,".exe",NULL,OFN_FILEMUSTEXIST /*| OFN_HIDEREADONLY*/,"*.exe",this);
if (cfgSave.DoModal() == IDOK)
{
CFile fileSave;
if (fileSave.Open(cfgSave.GetPathName(),CFile::modeCreate | CFile::modeWrite))
{
fileSave.Write(pData,dwSize);
fileSave.Close();
}else
MessageBox("fileSave.Open failed",NULL,MB_OK);
}
free(pData);
}
}
CFileDialog cfg(TRUE,".exe",NULL,OFN_FILEMUSTEXIST | OFN_HIDEREADONLY,"Executable Files (*.exe)|*.exe|All Files(*.*)|*.*||",this,0);
if (cfg.DoModal() == IDOK)
{
BYTE *pData;
DWORD dwSize;
CFile file;
if (file.Open(cfg.GetPathName(),CFile::typeBinary)){
dwSize = (DWORD)file.GetLength();
pData = (BYTE *)malloc(dwSize);
if (pData == NULL)return;
file.Read(pData,dwSize);
file.Close();
CFileDialog cfgSave(FALSE,".exe",NULL,OFN_FILEMUSTEXIST /*| OFN_HIDEREADONLY*/,"*.exe",this);
if (cfgSave.DoModal() == IDOK)
{
CFile fileSave;
if (fileSave.Open(cfgSave.GetPathName(),CFile::modeCreate | CFile::modeWrite))
{
fileSave.Write(pData,dwSize);
fileSave.Close();
}else
MessageBox("fileSave.Open failed",NULL,MB_OK);
}
free(pData);
}
}