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.

115 lines
3.2 KiB

  1. // Extensionsaw.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "Ext.h"
  5. #include "Extaw.h"
  6. #include "chooser.h"
  7. #ifdef _PSEUDO_DEBUG
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. // This is called immediately after the custom AppWizard is loaded. Initialize
  12. // the state of the custom AppWizard here.
  13. void CExtensionsAppWiz::InitCustomAppWiz()
  14. {
  15. GUID guidTemp;
  16. WCHAR wszGUID[50];
  17. _pChooser = new CDialogChooser;
  18. SetNumberOfSteps(2);
  19. // Inform AppWizard that we're making a DLL.
  20. m_Dictionary[_T("PROJTYPE_DLL")] = _T("1");
  21. // Set template macros based on the project name entered by the user.
  22. // Get value of $$root$$ (already set by AppWizard)
  23. CString strRoot;
  24. m_Dictionary.Lookup(_T("root"), strRoot);
  25. // Set value of $$Doc$$, $$DOC$$
  26. CString strDoc = strRoot.Left(6);
  27. m_Dictionary[_T("Doc")] = strDoc;
  28. strDoc.MakeUpper();
  29. m_Dictionary[_T("DOC")] = strDoc;
  30. // Set value of $$MAC_TYPE$$
  31. strRoot = strRoot.Left(4);
  32. int nLen = strRoot.GetLength();
  33. if (strRoot.GetLength() < 4)
  34. {
  35. CString strPad(_T(' '), 4 - nLen);
  36. strRoot += strPad;
  37. }
  38. strRoot.MakeUpper();
  39. m_Dictionary[_T("MAC_TYPE")] = strRoot;
  40. if (SUCCEEDED(CoCreateGuid(&guidTemp)))
  41. {
  42. StringFromGUID2(guidTemp, wszGUID, ARRAYSIZE(wszGUID));
  43. Extensionsaw.m_Dictionary[TEXT("LibGUID")] = StripCurly(wszGUID);
  44. }
  45. }
  46. // This is called just before the custom AppWizard is unloaded.
  47. void CExtensionsAppWiz::ExitCustomAppWiz()
  48. {
  49. if (_pChooser)
  50. {
  51. delete _pChooser;
  52. _pChooser = NULL;
  53. }
  54. }
  55. // This is called when the user clicks "Create..." on the New Project dialog
  56. CAppWizStepDlg* CExtensionsAppWiz::Next(CAppWizStepDlg* pDlg)
  57. {
  58. return _pChooser->Next(pDlg);
  59. }
  60. // This is called when the user clicks "Back" on one of the custom
  61. // AppWizard's steps.
  62. CAppWizStepDlg* CExtensionsAppWiz::Back(CAppWizStepDlg* pDlg)
  63. {
  64. // Delegate to the dialog chooser
  65. return _pChooser->Back(pDlg);
  66. }
  67. void CExtensionsAppWiz::CustomizeProject(IBuildProject* pProject)
  68. {
  69. // TODO: Add code here to customize the project. If you don't wish
  70. // to customize project, you may remove this virtual override.
  71. // This is called immediately after the default Debug and Release
  72. // configurations have been created for each platform. You may customize
  73. // existing configurations on this project by using the methods
  74. // of IBuildProject and IConfiguration such as AddToolSettings,
  75. // RemoveToolSettings, and AddCustomBuildStep. These are documented in
  76. // the Developer Studio object model documentation.
  77. // WARNING!! IBuildProject and all interfaces you can get from it are OLE
  78. // COM interfaces. You must be careful to release all new interfaces
  79. // you acquire. In accordance with the standard rules of COM, you must
  80. // NOT release pProject, unless you explicitly AddRef it, since pProject
  81. // is passed as an "in" parameter to this function. See the documentation
  82. // on CCustomAppWiz::CustomizeProject for more information.
  83. }
  84. // Here we define one instance of the CExtensionsAppWiz class. You can access
  85. // m_Dictionary and any other public members of this class through the
  86. // global Extensionsaw.
  87. CExtensionsAppWiz Extensionsaw;
  88. CString StripCurly(CString str)
  89. {
  90. return str.Mid(1, str.GetLength() - 2);
  91. }