home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / appwiz / hierwiz / loadfile.cpp < prev    next >
C/C++ Source or Header  |  1998-03-05  |  2KB  |  86 lines

  1. // loadfile.cpp : implementation file
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and Microsoft
  9. // QuickHelp and/or WinHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "hierwiz.h"
  15. #include "loadfile.h"
  16. #include "hierwaw.h"
  17.  
  18. #ifdef _DEBUG
  19. #undef THIS_FILE
  20. static char BASED_CODE THIS_FILE[] = __FILE__;
  21. #endif
  22.  
  23.  
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CLoadFileDlg dialog
  27.  
  28.  
  29. CLoadFileDlg::CLoadFileDlg()
  30.     : CAppWizStepDlg(CLoadFileDlg::IDD)
  31. {
  32.     //{{AFX_DATA_INIT(CLoadFileDlg)
  33.     m_strProjName = _T("mfcclass.hie");
  34.     //}}AFX_DATA_INIT
  35. }
  36.  
  37.  
  38. void CLoadFileDlg::DoDataExchange(CDataExchange* pDX)
  39. {
  40.     CAppWizStepDlg::DoDataExchange(pDX);
  41.     //{{AFX_DATA_MAP(CLoadFileDlg)
  42.     DDX_Text(pDX, IDC_PROJ_NAME, m_strProjName);
  43.     //}}AFX_DATA_MAP
  44. }
  45.  
  46.  
  47. BEGIN_MESSAGE_MAP(CLoadFileDlg, CAppWizStepDlg)
  48.     //{{AFX_MSG_MAP(CLoadFileDlg)
  49.     ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
  50.     ON_WM_PAINT()
  51.     //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53.  
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CLoadFileDlg message handlers
  57.  
  58. BOOL CLoadFileDlg::OnDismiss()
  59. {
  60.     UpdateData(TRUE);
  61.     // If the user specifies no path, use the default
  62.     if (m_strProjName.IsEmpty())
  63.     {
  64.         m_strProjName ="mfcclass.hie" ;
  65.         UpdateData(FALSE) ;
  66.     }
  67.     hierwizaw.m_Dictionary.SetAt("hiersample",m_strProjName) ;
  68.     return TRUE;
  69. }
  70.  
  71. // Handle the "Browse..." button by popping up a file navigator.
  72. void CLoadFileDlg::OnBrowse()
  73. {
  74.     CFileDialog dlg(
  75.         TRUE,                                       // Open File Dialog
  76.         _T("hie"),                                  // Default extension
  77.         NULL,                                       // No default filename
  78.         OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,     // OPENFILENAME flags
  79.         _T("Hierserver Files|*.hie|All Files|*.*||"));  // Filter strings
  80.  
  81.     if (dlg.DoModal() == IDOK)
  82.         m_strProjName = dlg.GetPathName();
  83.  
  84.     UpdateData(FALSE);
  85. }
  86.