Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.3 KiB

  1. // ExtensionChoice.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "Ext.h"
  5. #include "Extaw.h"
  6. #include "Extdlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // ExtensionChoice dialog
  14. ExtensionChoice::ExtensionChoice()
  15. : CAppWizStepDlg(ExtensionChoice::IDD)
  16. {
  17. //{{AFX_DATA_INIT(ExtensionChoice)
  18. m_strClassDescription = _T("");
  19. m_strClassType = _T("");
  20. m_strFileExt = _T("");
  21. //}}AFX_DATA_INIT
  22. }
  23. void ExtensionChoice::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CAppWizStepDlg::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(ExtensionChoice)
  27. DDX_Control(pDX, IDC_EXT_EDIT, m_edtExt);
  28. DDX_Text(pDX, IDC_CLASSDESC_EDIT, m_strClassDescription);
  29. DDX_Text(pDX, IDC_CLASSTYPE_EDIT, m_strClassType);
  30. DDX_Text(pDX, IDC_EXT_EDIT, m_strFileExt);
  31. //}}AFX_DATA_MAP
  32. }
  33. BEGIN_MESSAGE_MAP(ExtensionChoice, CAppWizStepDlg)
  34. //{{AFX_MSG_MAP(ExtensionChoice)
  35. // NOTE: the ClassWizard will add message map macros here
  36. //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38. /////////////////////////////////////////////////////////////////////////////
  39. // ExtensionChoice message handlers
  40. CString StripSpaces(CString& str)
  41. {
  42. CString str2;
  43. for(int i = 0; i < str.GetLength(); i++)
  44. {
  45. if (str[i] != TEXT(' '))
  46. str2 += str[i];
  47. }
  48. return str2;
  49. }
  50. BOOL ExtensionChoice::OnDismiss()
  51. {
  52. BOOL bRet = TRUE;
  53. UpdateData(TRUE);
  54. CString strWarn;
  55. if (m_strFileExt.Left(1) == TEXT("."))
  56. {
  57. strWarn.LoadString(IDS_FILEWARN);
  58. bRet = FALSE;
  59. }
  60. if (bRet)
  61. {
  62. if (!m_strFileExt.IsEmpty() && !m_strClassType.IsEmpty())
  63. {
  64. Extensionsaw.m_Dictionary[TEXT("Extension")] = m_strFileExt;
  65. // Extensionsaw.m_Dictionary[TEXT("Class Type")] = m_strClassType;
  66. Extensionsaw.m_Dictionary[TEXT("ClassType")] = m_strClassType;
  67. Extensionsaw.m_Dictionary[TEXT("ClassDescription")] = m_strClassDescription;
  68. }
  69. else
  70. {
  71. strWarn.LoadString(IDS_BLANKWARN);
  72. bRet = FALSE;
  73. }
  74. }
  75. if (!bRet)
  76. {
  77. CString strProgram((LPCTSTR)IDS_PROGRAM);
  78. MessageBox(strWarn, strProgram, MB_OK);
  79. m_edtExt.SetFocus();
  80. }
  81. return bRet;
  82. }