Leaked source code of windows server 2003
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.

194 lines
5.0 KiB

  1. // viewex.cpp : Defines the class behaviors for the application.
  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 related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12. #include "stdafx.h"
  13. #include "adsqdoc.h"
  14. #include "viewex.h"
  15. #include "schemavw.h"
  16. #include "adsqview.h"
  17. #include "bwsview.h"
  18. #include "splitter.h"
  19. #include "schclss.h"
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char BASED_CODE THIS_FILE[] = __FILE__;
  23. #endif
  24. IDispatch* pACEClipboard;
  25. IDispatch* pACLClipboard;
  26. IDispatch* pSDClipboard;
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CViewExApp
  29. BEGIN_MESSAGE_MAP(CViewExApp, CWinApp)
  30. //{{AFX_MSG_MAP(CViewExApp)
  31. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  32. //}}AFX_MSG_MAP
  33. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  34. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CViewExApp construction
  38. // Place all significant initialization in InitInstance
  39. /***********************************************************
  40. Function:
  41. Arguments:
  42. Return:
  43. Purpose:
  44. Author(s):
  45. Revision:
  46. Date:
  47. ***********************************************************/
  48. CViewExApp::CViewExApp()
  49. {
  50. //afxMemDF |= delayFreeMemDF | checkAlwaysMemDF;
  51. }
  52. /***********************************************************
  53. Function:
  54. Arguments:
  55. Return:
  56. Purpose:
  57. Author(s):
  58. Revision:
  59. Date:
  60. ***********************************************************/
  61. CViewExApp::~CViewExApp()
  62. {
  63. // DUMP_TRACKING_INFO();
  64. }
  65. /////////////////////////////////////////////////////////////////////////////
  66. // The one and only CViewExApp object
  67. CViewExApp NEAR theApp;
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CViewExApp initialization
  70. /***********************************************************
  71. Function:
  72. Arguments:
  73. Return:
  74. Purpose:
  75. Author(s):
  76. Revision:
  77. Date:
  78. ***********************************************************/
  79. BOOL CViewExApp::InitInstance()
  80. {
  81. // Standard initialization
  82. Enable3dControls();
  83. if( FAILED(OleInitialize( NULL )) )
  84. {
  85. TRACE0( "OleInitialize failed" );
  86. return 0;
  87. }
  88. // splitter frame with both simple text output and form input view
  89. AddDocTemplate(new CMultiDocTemplate(IDR_SPLIT2TYPE,
  90. RUNTIME_CLASS(CMainDoc),
  91. RUNTIME_CLASS(CSplitterFrame),
  92. RUNTIME_CLASS(CBrowseView)));
  93. AddDocTemplate( new CMultiDocTemplate(
  94. IDR_QUERYVIEW,
  95. RUNTIME_CLASS(CAdsqryDoc),
  96. RUNTIME_CLASS(CMDIChildWnd), // custom MDI child frame
  97. RUNTIME_CLASS(CAdsqryView)) );
  98. // create main MDI Frame window
  99. // Please note that for simple MDI Frame windows with no toolbar,
  100. // status bar or other special behavior, the CMDIFrameWnd class
  101. // can be used directly for the main frame window just as the
  102. // CMDIChildWnd can be use for a document frame window.
  103. CMDIFrameWnd* pMainFrame = new CMDIFrameWnd;
  104. if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  105. return FALSE;
  106. // Also in this example, there is only one menubar shared between
  107. // all the views. The automatic menu enabling support of MFC
  108. // will disable the menu items that don't apply based on the
  109. // currently active view. The one MenuBar is used for all
  110. // document types, including when there are no open documents.
  111. // Now finally show the main menu
  112. pMainFrame->ShowWindow(m_nCmdShow);
  113. pMainFrame->UpdateWindow();
  114. m_pMainWnd = pMainFrame;
  115. #ifndef _MAC
  116. // command line arguments are ignored, create a new (empty) document
  117. OnFileNew();
  118. #endif
  119. return TRUE;
  120. }
  121. /////////////////////////////////////////////////////////////////////////////
  122. // CViewExApp commands
  123. /***********************************************************
  124. Function:
  125. Arguments:
  126. Return:
  127. Purpose:
  128. Author(s):
  129. Revision:
  130. Date:
  131. ***********************************************************/
  132. void CViewExApp::OnAppAbout()
  133. {
  134. CDialog(IDD_ABOUTBOX).DoModal();
  135. }
  136. /***********************************************************
  137. Function:
  138. Arguments:
  139. Return:
  140. Purpose:
  141. Author(s):
  142. Revision:
  143. Date:
  144. ***********************************************************/
  145. int CViewExApp::ExitInstance()
  146. {
  147. if( NULL != pACEClipboard )
  148. {
  149. pACEClipboard->Release( );
  150. }
  151. if( NULL != pACLClipboard )
  152. {
  153. pACLClipboard->Release( );
  154. }
  155. if( NULL != pSDClipboard )
  156. {
  157. pSDClipboard->Release( );
  158. }
  159. OleUninitialize( );
  160. return CWinApp::ExitInstance( );
  161. }