// I want to set the path
You could try to set it explicitly, for any file operation :) :
class CPathHolder : public CString
{
public:
CPathHolder() :
#ifdef UNDER_CE // or another of your mobile defines
CString(_T("\\Work\\your_files\\")) {} #esle
CString(_T("C:\\Work\\your_files\\")) {} #endif
}
CString& GetPathHolder()
{
static CPathHolder cPathHolder;
return cPathHolder;
}
CString& GetCurrentPath()
{
return GetPathHolder();
}
void SetCurrentPath(const CString& cszNewPath)
{
GetPathHolder() = cszNewPath;
}
void CYourApp::CYourApp()
{
SetCurrentPath(
#ifdef UNDER_CE
_T("\\Work\\PhotoViewer\\LastFiles\\")
#else
_T("C:\\Work\\PhotoViewer\\LastFiles\\")
#endif
);
}
void CYourApp::ShowPngFile(const CString& cszPngFileNameWithoutPath)
{
CString cszFullFileName(GetCurrentPath() + cszPngFileNameWithoutPath);
}