// ConfirmDlg.cpp : implementation file
//

#include "stdafx.h"
#include "mw4gameed.h"
#include "ConfirmDlg.h"

/////////////////////////////////////////////////////////////////////////////
// CConfirmDlg dialog


CConfirmDlg::CConfirmDlg(int id, CWnd* pParent /*=NULL*/)
	: CDialog(CConfirmDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CConfirmDlg)
	m_NeverCheck = FALSE;
	//}}AFX_DATA_INIT

	m_ID = id;
	m_Show = true;
	m_Title = "";
	m_MessageText = "No Text Was Specified!!!";
	CString keyname = "ConfirmDlg";
	char string[8];
	keyname += itoa(m_ID,string,10);
	DWORD size=sizeof(m_Show);
	gos_LoadDataFromRegistry((char *)(LPCTSTR)keyname,&m_Show,&size);
}


void CConfirmDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CConfirmDlg)
	DDX_Control(pDX, IDC_CONFIRMTEXT, m_ConfirmText);
	DDX_Check(pDX, IDC_CONFIRMCHECK, m_NeverCheck);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CConfirmDlg, CDialog)
	//{{AFX_MSG_MAP(CConfirmDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CConfirmDlg message handlers

BOOL CConfirmDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	SetWindowText(m_Title);
	m_ConfirmText.SetWindowText(m_MessageText);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

int CConfirmDlg::DoModal() 
{
	int retVal = IDOK;

	if (m_Show)	
		retVal = CDialog::DoModal();

	if (m_NeverCheck)
	{
		m_Show = false;
		CString keyname = "ConfirmDlg";
		char string[8];
		keyname += itoa(m_ID,string,10);
		gos_SaveDataToRegistry((char *)(LPCTSTR)keyname,&m_Show,sizeof(m_Show));
	}
	return retVal;
}
