Projects > KM-RW Project > KM-RWSettings.h

Home | Projects | Links

 

KM-RW PROJECT

  

KM-RWDlg-Decl.h    KM-RWDlg-Impl_and_Play-Rec_Proc.h    KM-RWSettings.h    StoreStruct.h    cwfi.h

Download km-rw.exe (392 KB)        Download VC++ 8.0 Project (26.8 KB RAR Archive)        KM-RW Help


#ifndef KMRWSETTINGS_H
#define KMRWSETTINGS_H

// Default falues for Journal and Settings file paths:
CString SettingsFilePath="KMRWSettings.i44";
CString DefJournalFilePath="KMRWJournal.i45";

//-------------------------------------------------------------------------------------------------------------------

class KMRWSettings : public CObject{

DECLARE_SERIAL( KMRWSettings )

public:
//Settings:
int PlayTimes;
bool PlayOnStartup;
bool PlayAtRecSpeed;
CString PlayFilePath;

bool LoadSettings();
bool SaveSettings();

void Serialize(CArchive & ar);

KMRWSettings() : PlayTimes(1), PlayOnStartup(0), PlayAtRecSpeed(1), PlayFilePath(DefJournalFilePath) {}
~KMRWSettings(){}
};

//-------------------------------------------------------------------------------------------------------------------
IMPLEMENT_SERIAL(KMRWSettings,CObject,1)

//-------------------------------------------------------------------------------------------------------------------
void KMRWSettings::Serialize(CArchive & ar){
CObject::Serialize( ar );
 
   if ( ar.IsStoring() )
   {
      ar << PlayTimes << PlayOnStartup << PlayAtRecSpeed << PlayFilePath;
   }
   else
   {
      ar >> PlayTimes >> PlayOnStartup >> PlayAtRecSpeed >> PlayFilePath;
   }
}
//-------------------------------------------------------------------------------------------------------------------
bool KMRWSettings::LoadSettings(){
CFile sf;
if(!sf.Open("KMRWSettings.i44", CFile::modeRead)) return 0;

CArchive ar(&sf,CArchive::load);
Serialize(ar);

ar.Close();
sf.Close();
return 1;
}
//-------------------------------------------------------------------------------------------------------------------
bool KMRWSettings::SaveSettings(){
CFile sf;
if(!sf.Open("KMRWSettings.i44",CFile::modeWrite | CFile::modeCreate | CFile::modeNoTruncate) ) return 0;

CArchive ar(&sf,CArchive::store);
Serialize(ar);

ar.Close();
sf.Close();
return 1;
}



#endif


KM-RWDlg-Decl.h    KM-RWDlg-Impl_and_Play-Rec_Proc.h    KM-RWSettings.h    StoreStruct.h    cwfi.h

 Download km-rw.exe (392 KB)         Download VC++ 8.0 Project (26.8 KB RAR Archive)        KM-RW Help

 

Get WinRAR

 

 

Copyright © Yuri Bulankov 2004

 

Bugs/Comments: code@compilerabuse.com

Copyright (C) 2001-2006 Yuri Bulankov. All rights reserved.