Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

A reminder tool for .dan.g's ToDoList

, 25 Feb 2004
A simple reminder tool to remind you of your overdue tasks in ToDoList throughout the day
tdlremindertool_demo.zip
zlib.dll
iconv.dll
libxml2.dll
TDLReminderTool.exe
Reminder.wav
tdlremindertool_src.zip
Projects
TDLReminderTool
TDLReminderTool.dsw
TDLReminderTool.clw
TDLReminderTool.dsp
res
TDLReminderTool.ico
Reminder.wav
// TDLConfig.cpp: implementation of the CTDLConfig class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "TDLReminderTool.h"
#include "TDLConfig.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CTDLConfig::CTDLConfig()
{
	m_remFreq = 30;
	m_remFreqType=1;
	m_updFreq = 1;
	m_updFreqType=0;
	m_audioFile = "";
	m_playAudio = 0;
}

CTDLConfig::~CTDLConfig()
{

}

void CTDLConfig::ReadConfiguration()
{

	HKEY hKey = NULL;
	if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,"Software\\TDLRemTool",0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL)==ERROR_SUCCESS)
	{
		DWORD type = REG_DWORD;
		BYTE data[256];
		DWORD dataSize = 256;
		ZeroMemory(data,256);
		if(RegQueryValueEx(hKey,"RemFreq",NULL,&type,data,&dataSize)==ERROR_SUCCESS)
		{
			char* p = (char*)data;
			m_remFreq = *p;
		}
		if(RegQueryValueEx(hKey,"RemFreqType",NULL,&type,data,&dataSize)==ERROR_SUCCESS)
		{
			char* p = (char*)data;
			m_remFreqType = *p;
		}
		if(RegQueryValueEx(hKey,"UpdFreq",NULL,&type,data,&dataSize)==ERROR_SUCCESS)
		{
			char* p = (char*)data;
			m_updFreq = *p;
		}

		if(RegQueryValueEx(hKey,"UpdFreqType",NULL,&type,data,&dataSize)==ERROR_SUCCESS)
		{
			char* p = (char*)data;
			m_updFreqType =*p;
		}

		if(RegQueryValueEx(hKey,"PlayAudio",NULL,&type,data,&dataSize)==ERROR_SUCCESS)
		{
			char* p = (char*)data;
			m_playAudio =*p;
		}

		type = REG_SZ;
		ZeroMemory(data,256);
		dataSize = 256;
		if(RegQueryValueEx(hKey,"AudioFile",NULL,&type,data,&dataSize)==ERROR_SUCCESS)
		{
			char* p = (char*)data;
			m_audioFile =p;

		}

	}

	RegCloseKey(hKey);
}

void CTDLConfig::SaveConfiguration()
{
	HKEY hKey = NULL;
	if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,"Software\\TDLRemTool",0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL)==ERROR_SUCCESS)
	{
		DWORD type = REG_DWORD;
		RegSetValueEx(hKey,"RemFreq",0,type,(LPBYTE)&m_remFreq,sizeof(DWORD));
		RegSetValueEx(hKey,"RemFreqType",0,type,(LPBYTE)&m_remFreqType,sizeof(DWORD));
		RegSetValueEx(hKey,"UpdFreq",0,type,(LPBYTE)&m_updFreq,sizeof(DWORD));
		RegSetValueEx(hKey,"UpdFreqType",0,type,(LPBYTE)&m_updFreqType,sizeof(DWORD));
		RegSetValueEx(hKey,"PlayAudio",0,type,(LPBYTE)&m_playAudio,sizeof(DWORD));

		type = REG_SZ;
		char buff[256];
		ZeroMemory(buff,256);
		CopyMemory(buff,m_audioFile.GetBuffer(m_audioFile.GetLength()),m_audioFile.GetLength());

		RegSetValueEx(hKey,"AudioFile",0,type,(LPBYTE)buff,m_audioFile.GetLength());
	}

	RegCloseKey(hKey);
}

void CTDLConfig::setRemFreq(int remFreq)
{
	m_remFreq = remFreq;
}

void CTDLConfig::setRemFreqType(int remFreqType)
{
	m_remFreqType=remFreqType;
}

void CTDLConfig::setUpdFreq(int updFreq)
{
	m_updFreq = updFreq;
}

void CTDLConfig::setUpdFreqType(int updFreqType)
{
	m_updFreqType=updFreqType;
}


int CTDLConfig::getRemFreq()
{
	return m_remFreq;
}

int CTDLConfig::getRemFreqType()
{
	return m_remFreqType;
}

int CTDLConfig::getUpdFreq()
{
	return m_updFreq;
}

int CTDLConfig::getUpdFreqType()
{
	return m_updFreqType;
}

void CTDLConfig::setPlayAudio(int play)
{
	m_playAudio = play;
}
void CTDLConfig::setAudioFile(CString file)
{
	m_audioFile = file;
}
int CTDLConfig::getPlayAudio()
{
	return m_playAudio;
}
CString CTDLConfig::getAudioFile()
{
	
	m_audioFile.TrimLeft();
	m_audioFile.TrimRight();
	CFileStatus status;
	if(!CFile::GetStatus(m_audioFile,status))
		m_audioFile = "";

	return m_audioFile;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Alberto Bar-Noy
Team Leader www.unitronics.com
Israel Israel
No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 26 Feb 2004
Article Copyright 2004 by Alberto Bar-Noy
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid