home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / DEMOT.ZIP / Src / demo_toolbar / demo_toolbar.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-23  |  5.5 KB  |  187 lines

  1. // demo_toolbar.cpp : Defines the class behaviors for the application.
  2. //
  3. // 1998 Kirk Stowell ( kstowel@sprynet.com )
  4. // www.geocities.com/SiliconValley/Haven/8230/index.html
  5. //
  6. // You are free to use, modify and distribute this source, as long as
  7. // there is no charge, and this HEADER stays intact. This source is
  8. // supplied "AS-IS", and without WARRANTY OF ANY KIND, and the user
  9. // holds the author blameless for any or all problems that may arise
  10. // from the use of this code.
  11. //
  12. //////////////////////////////////////////////////////////////////////
  13.  
  14. #include "stdafx.h"
  15. #include "demo_toolbar.h"
  16.  
  17. #include "MainFrm.h"
  18. #include "ChildFrm.h"
  19. #include "demo_toolbarDoc.h"
  20. #include "demo_toolbarView.h"
  21.  
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CDemo_toolbarApp
  30.  
  31. BEGIN_MESSAGE_MAP(CDemo_toolbarApp, CWinApp)
  32.     //{{AFX_MSG_MAP(CDemo_toolbarApp)
  33.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  34.         // NOTE - the ClassWizard will add and remove mapping macros here.
  35.         //    DO NOT EDIT what you see in these blocks of generated code!
  36.     //}}AFX_MSG_MAP
  37.     // Standard file based document commands
  38.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  39.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  40.     // Standard print setup command
  41.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  42. END_MESSAGE_MAP()
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CDemo_toolbarApp construction
  46.  
  47. CDemo_toolbarApp::CDemo_toolbarApp()
  48. {
  49.     // TODO: add construction code here,
  50.     // Place all significant initialization in InitInstance
  51. }
  52.  
  53. /////////////////////////////////////////////////////////////////////////////
  54. // The one and only CDemo_toolbarApp object
  55.  
  56. CDemo_toolbarApp theApp;
  57.  
  58. /////////////////////////////////////////////////////////////////////////////
  59. // CDemo_toolbarApp initialization
  60.  
  61. BOOL CDemo_toolbarApp::InitInstance()
  62. {
  63.     AfxEnableControlContainer();
  64.  
  65.     // Standard initialization
  66.     // If you are not using these features and wish to reduce the size
  67.     //  of your final executable, you should remove from the following
  68.     //  the specific initialization routines you do not need.
  69.  
  70. #ifdef _AFXDLL
  71.     Enable3dControls();            // Call this when using MFC in a shared DLL
  72. #else
  73.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  74. #endif
  75.  
  76.     // Change the registry key under which our settings are stored.
  77.     // You should modify this string to be something appropriate
  78.     // such as the name of your company or organization.
  79.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  80.  
  81.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  82.  
  83.     // Register the application's document templates.  Document templates
  84.     //  serve as the connection between documents, frame windows and views.
  85.  
  86.     CMultiDocTemplate* pDocTemplate;
  87.     pDocTemplate = new CMultiDocTemplate(
  88.         IDR_DEMO_TTYPE,
  89.         RUNTIME_CLASS(CDemo_toolbarDoc),
  90.         RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  91.         RUNTIME_CLASS(CDemo_toolbarView));
  92.     AddDocTemplate(pDocTemplate);
  93.  
  94.     // create main MDI Frame window
  95.     CMainFrame* pMainFrame = new CMainFrame;
  96.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  97.         return FALSE;
  98.     m_pMainWnd = pMainFrame;
  99.  
  100.     // Parse command line for standard shell commands, DDE, file open
  101.     CCommandLineInfo cmdInfo;
  102.     ParseCommandLine(cmdInfo);
  103.  
  104.     // Dispatch commands specified on the command line
  105.     if (!ProcessShellCommand(cmdInfo))
  106.         return FALSE;
  107.  
  108.     // The main window has been initialized, so show and update it.
  109.     pMainFrame->ShowWindow(m_nCmdShow);
  110.     pMainFrame->UpdateWindow();
  111.  
  112.     return TRUE;
  113. }
  114.  
  115. /////////////////////////////////////////////////////////////////////////////
  116. // CAboutDlg dialog used for App About
  117.  
  118. class CAboutDlg : public CDialog
  119. {
  120. public:
  121.     CAboutDlg();
  122.  
  123. // Dialog Data
  124.     //{{AFX_DATA(CAboutDlg)
  125.     enum { IDD = IDD_ABOUTBOX };
  126.     CHyperLink    m_hyperLink1;
  127.     CHyperLink    m_hyperLink2;
  128.     CHyperLink    m_hyperLink3;
  129.     //}}AFX_DATA
  130.  
  131.     // ClassWizard generated virtual function overrides
  132.     //{{AFX_VIRTUAL(CAboutDlg)
  133.     protected:
  134.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  135.     //}}AFX_VIRTUAL
  136.  
  137. // Implementation
  138. protected:
  139.     //{{AFX_MSG(CAboutDlg)
  140.     virtual BOOL OnInitDialog();
  141.     //}}AFX_MSG
  142.     DECLARE_MESSAGE_MAP()
  143. };
  144.  
  145. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  146. {
  147.     //{{AFX_DATA_INIT(CAboutDlg)
  148.     //}}AFX_DATA_INIT
  149. }
  150.  
  151. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  152. {
  153.     CDialog::DoDataExchange(pDX);
  154.     //{{AFX_DATA_MAP(CAboutDlg)
  155.     DDX_Control(pDX, IDC_URL_MAILME, m_hyperLink1);
  156.     DDX_Control(pDX, IDC_URL_ADDRESS, m_hyperLink2);
  157.     DDX_Control(pDX, IDC_URL_COMMCTRL, m_hyperLink3);
  158.     //}}AFX_DATA_MAP
  159. }
  160.  
  161. BOOL CAboutDlg::OnInitDialog() 
  162. {
  163.     CDialog::OnInitDialog();
  164.     
  165.     m_hyperLink1.SetURL(_T("mailto:kstowel@sprynet.com"));
  166.     m_hyperLink2.SetURL(_T("http://www.geocities.com/SiliconValley/Haven/8230/index.html"));
  167.     m_hyperLink3.SetURL(_T("http://www.microsoft.com/msdn/downloads/files/40comupd.htm"));
  168.     
  169.     return TRUE;  // return TRUE unless you set the focus to a control
  170.                   // EXCEPTION: OCX Property Pages should return FALSE
  171. }
  172.  
  173. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  174.     //{{AFX_MSG_MAP(CAboutDlg)
  175.     //}}AFX_MSG_MAP
  176. END_MESSAGE_MAP()
  177.  
  178. // App command to run the dialog
  179. void CDemo_toolbarApp::OnAppAbout()
  180. {
  181.     CAboutDlg aboutDlg;
  182.     aboutDlg.DoModal();
  183. }
  184.  
  185. /////////////////////////////////////////////////////////////////////////////
  186. // CDemo_toolbarApp commands
  187.