/***************************************************************************
**
**    $Header:   D:/ECB2S/SRC/LOG/DIAGNRES.CPP   1.2.1.5   17 Apr 1997 15:47:58   ZJRD  $
**
**    $Log:   D:/ECB2S/SRC/LOG/DIAGNRES.CPP  $
** 
**    Rev 1.2.1.5   17 Apr 1997 15:47:58   ZJRD
** No change.
** 
**    Rev 1.2.1.4   16 Apr 1997 10:19:14   ZJRD
** No change.
** 
**    Rev 1.2.1.3   10 Apr 1997 15:30:40   ZJRD
** 2.09F
** 
**    Rev 1.2.1.1   03 Apr 1997 15:11:36   ZJRD
** No change.
** 
**    Rev 1.2.1.0   28 Mar 1997 10:16:36   ZJRD
** easy pack sld 2.09d
** 
**    Rev 1.1   19 Mar 1997 11:27:44   ZJRD
** No change.
** 
**    Rev 1.0   12 Mar 1997 14:45:44   ZJRD
** Initial revision.
** 
**    Rev 1.7.1.0.1.2   09 Dec 1996 10:16:40   ZJRD
** EasyPack/SLD Version 2.0P
** 
**    Rev 1.7.1.0.1.0   11 Nov 1996 12:59:54   ZJRD
** EasyPack/SLD Version 2.01
** 
**    Rev 1.7.1.4   09 Sep 1996 13:19:38   ZJRD
** No change.
** 
**    Rev 1.7.1.3   05 Sep 1996 11:31:08   ZJRD
** No change.
** 
**    Rev 1.7.1.2   02 Sep 1996 09:58:12   ZJRD
** No change.
** 
**    Rev 1.7.1.1   28 Aug 1996 15:48:12   ZJRD
** No change.
** 
**    Rev 1.7.1.0   12 Aug 1996 10:52:46   ZJRD
** EasyPack/SLD Version 1.98
** 
**    Rev 1.5   05 Jun 1996 14:56:02   ZJRD
** No change.
** 
**    Rev 1.4   29 May 1996 09:37:22   ZJRD
** No change.
** 
**    Rev 1.3   16 May 1996 09:02:00   ZJRD
** No change.
** 
**    Rev 1.2   10 May 1996 09:16:50   ZJRD
** No change.
** 
**    Rev 1.1   02 May 1996 10:31:12   ZJRD
** EasyPack/SLD Version 1.92
** 
**    Rev 1.1   18 Apr 1996 12:56:38   Shirley
** No change.
** 
**    Rev 1.0   12 Apr 1996 10:36:02   Shirley
** Initial revision.
** 
****************************************************************************/
// diagnres.cpp : implementation file
//
//john chow 96.3
#include "stdafx.h"
//#include "ep-sld.h"
#include "diagnres.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDiagnResultBox dialog


CDiagnResultBox::CDiagnResultBox(CWnd* pParent /*=NULL*/)
	: CDialog(CDiagnResultBox::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDiagnResultBox)
	m_ShowInfo = "";
	//}}AFX_DATA_INIT
}

void CDiagnResultBox::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDiagnResultBox)
	DDX_Text(pDX, IDC_EDIT_SHOWINFO, m_ShowInfo);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CDiagnResultBox, CDialog)
	//{{AFX_MSG_MAP(CDiagnResultBox)
	ON_BN_CLICKED(IDC_BUTTON_SAVE, OnButtonSave)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CDiagnResultBox message handlers

void CDiagnResultBox::OnButtonSave()
{
	// TODO: Add your control notification handler code here
	static char BASED_CODE szFilter[] = "Normal Files (*.dgn) |*.dgn | All Files"
	                                    " (*.*) | *.*||";
	
    CFileDialog* tmpDialog = new CFileDialog(FALSE,"*.dgn",NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
     										 szFilter,NULL);
    tmpDialog->m_ofn.lpstrTitle = "Save Diagnosis Detail Information";
    if (tmpDialog->DoModal() == IDOK) {
        CString pFileName = tmpDialog->GetPathName();
        
        CFile saveFile;                   
        //OPEN FILE
        if( !saveFile.Open( pFileName, CFile::modeCreate ) ) {
            AfxMessageBox("Diagnosis Save File Creating Error!");
            return;	
	    }          
        saveFile.Close();           
        if( !saveFile.Open( pFileName, CFile::modeReadWrite ) ) {
            AfxMessageBox("Diagnosis Save File Openning Error!"); 
            return;	
        }    
        //save information
        saveFile.Write( m_ShowInfo.GetBuffer(m_ShowInfo.GetLength()),
                        m_ShowInfo.GetLength());
        m_ShowInfo.ReleaseBuffer();    
        saveFile.Close(); 
    }        
    delete tmpDialog;
	
}

BOOL CDiagnResultBox::OnInitDialog()
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	CenterWindow();
	
//	UpdateData(FALSE);
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}
