home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / MINSPLIT.ZIP / MinSplitSize.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-07  |  4.4 KB  |  161 lines

  1. // MinSplitSize.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "MinSplitSize.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "ChildFrm.h"
  9. #include "MinSplitSizeDoc.h"
  10. #include "MinSplitSizeView.h"
  11.  
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CMinSplitSizeApp
  20.  
  21. BEGIN_MESSAGE_MAP(CMinSplitSizeApp, CWinApp)
  22.     //{{AFX_MSG_MAP(CMinSplitSizeApp)
  23.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code!
  26.     //}}AFX_MSG_MAP
  27.     // Standard file based document commands
  28.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  29.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CMinSplitSizeApp construction
  34.  
  35. CMinSplitSizeApp::CMinSplitSizeApp()
  36. {
  37.     // TODO: add construction code here,
  38.     // Place all significant initialization in InitInstance
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // The one and only CMinSplitSizeApp object
  43.  
  44. CMinSplitSizeApp theApp;
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CMinSplitSizeApp initialization
  48.  
  49. BOOL CMinSplitSizeApp::InitInstance()
  50. {
  51.     AfxEnableControlContainer();
  52.  
  53.     // Standard initialization
  54.     // If you are not using these features and wish to reduce the size
  55.     //  of your final executable, you should remove from the following
  56.     //  the specific initialization routines you do not need.
  57.  
  58. #ifdef _AFXDLL
  59.     Enable3dControls();            // Call this when using MFC in a shared DLL
  60. #else
  61.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  62. #endif
  63.  
  64.     // Change the registry key under which our settings are stored.
  65.     // You should modify this string to be something appropriate
  66.     // such as the name of your company or organization.
  67.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  68.  
  69.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  70.  
  71.     // Register the application's document templates.  Document templates
  72.     //  serve as the connection between documents, frame windows and views.
  73.  
  74.     CMultiDocTemplate* pDocTemplate;
  75.     pDocTemplate = new CMultiDocTemplate(
  76.         IDR_MINSPLTYPE,
  77.         RUNTIME_CLASS(CMinSplitSizeDoc),
  78.         RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  79.         RUNTIME_CLASS(CMinSplitSizeView));
  80.     AddDocTemplate(pDocTemplate);
  81.  
  82.     // create main MDI Frame window
  83.     CMainFrame* pMainFrame = new CMainFrame;
  84.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  85.         return FALSE;
  86.     m_pMainWnd = pMainFrame;
  87.  
  88.     // Parse command line for standard shell commands, DDE, file open
  89.     CCommandLineInfo cmdInfo;
  90.     ParseCommandLine(cmdInfo);
  91.  
  92.     // Dispatch commands specified on the command line
  93.     if (!ProcessShellCommand(cmdInfo))
  94.         return FALSE;
  95.  
  96.     AfxMessageBox(    "Limitations: Setting minimum sizes too big\n"
  97.                     "will enlarge the window when resized." );
  98.  
  99.     // The main window has been initialized, so show and update it.
  100.     pMainFrame->ShowWindow(m_nCmdShow);
  101.     pMainFrame->UpdateWindow();
  102.  
  103.     return TRUE;
  104. }
  105.  
  106. /////////////////////////////////////////////////////////////////////////////
  107. // CAboutDlg dialog used for App About
  108.  
  109. class CAboutDlg : public CDialog
  110. {
  111. public:
  112.     CAboutDlg();
  113.  
  114. // Dialog Data
  115.     //{{AFX_DATA(CAboutDlg)
  116.     enum { IDD = IDD_ABOUTBOX };
  117.     //}}AFX_DATA
  118.  
  119.     // ClassWizard generated virtual function overrides
  120.     //{{AFX_VIRTUAL(CAboutDlg)
  121.     protected:
  122.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  123.     //}}AFX_VIRTUAL
  124.  
  125. // Implementation
  126. protected:
  127.     //{{AFX_MSG(CAboutDlg)
  128.         // No message handlers
  129.     //}}AFX_MSG
  130.     DECLARE_MESSAGE_MAP()
  131. };
  132.  
  133. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  134. {
  135.     //{{AFX_DATA_INIT(CAboutDlg)
  136.     //}}AFX_DATA_INIT
  137. }
  138.  
  139. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  140. {
  141.     CDialog::DoDataExchange(pDX);
  142.     //{{AFX_DATA_MAP(CAboutDlg)
  143.     //}}AFX_DATA_MAP
  144. }
  145.  
  146. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  147.     //{{AFX_MSG_MAP(CAboutDlg)
  148.         // No message handlers
  149.     //}}AFX_MSG_MAP
  150. END_MESSAGE_MAP()
  151.  
  152. // App command to run the dialog
  153. void CMinSplitSizeApp::OnAppAbout()
  154. {
  155.     CAboutDlg aboutDlg;
  156.     aboutDlg.DoModal();
  157. }
  158.  
  159. /////////////////////////////////////////////////////////////////////////////
  160. // CMinSplitSizeApp commands
  161.