STATUSBAR.CPP
Upload User: bjaaa555
Upload Date: 2013-01-31
Package Size: 40k
Code Size: 3k
Category:

StatusBar

Development Platform:

Visual C++

  1. #include "stdafx.h"
  2. #include "StatusBar.h"
  3. #include "MainFrm.h"
  4. #include "StatusBarDoc.h"
  5. #include "StatusBarView.h"
  6. #include "XPaneText.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. BEGIN_MESSAGE_MAP(CStatusBarApp, CWinApp)
  13. //{{AFX_MSG_MAP(CStatusBarApp)
  14. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  15. ON_COMMAND(ID_TEST, OnTest)
  16. //}}AFX_MSG_MAP
  17. // Dateibasierte Standard-Dokumentbefehle
  18. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  19. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  20. // Standard-Druckbefehl "Seite einrichten"
  21. ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  22. END_MESSAGE_MAP()
  23. CStatusBarApp::CStatusBarApp() { }
  24. CStatusBarApp theApp;
  25. BOOL CStatusBarApp::InitInstance()
  26. {
  27. AfxEnableControlContainer();
  28. #ifdef _AFXDLL
  29. Enable3dControls();
  30. #else
  31. Enable3dControlsStatic();
  32. #endif
  33. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  34. LoadStdProfileSettings();
  35. CSingleDocTemplate* pDocTemplate;
  36. pDocTemplate = new CSingleDocTemplate(
  37. IDR_MAINFRAME,
  38. RUNTIME_CLASS(CStatusBarDoc),
  39. RUNTIME_CLASS(CMainFrame),
  40. RUNTIME_CLASS(CStatusBarView));
  41. AddDocTemplate(pDocTemplate);
  42. CCommandLineInfo cmdInfo;
  43. ParseCommandLine(cmdInfo);
  44. if (!ProcessShellCommand(cmdInfo)) return FALSE;
  45. m_pMainWnd->ShowWindow(SW_SHOW);
  46. m_pMainWnd->UpdateWindow();
  47. return TRUE;
  48. }
  49. class CAboutDlg : public CDialog
  50. {
  51. public:
  52. CAboutDlg();
  53. //{{AFX_DATA(CAboutDlg)
  54. enum { IDD = IDD_ABOUTBOX };
  55. //}}AFX_DATA
  56. //{{AFX_VIRTUAL(CAboutDlg)
  57. protected:
  58. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV-Unterst黷zung
  59. //}}AFX_VIRTUAL
  60. // Implementierung
  61. protected:
  62. //{{AFX_MSG(CAboutDlg)
  63. // Keine Nachrichten-Handler
  64. //}}AFX_MSG
  65. DECLARE_MESSAGE_MAP()
  66. };
  67. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  68. {
  69. //{{AFX_DATA_INIT(CAboutDlg)
  70. //}}AFX_DATA_INIT
  71. }
  72. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  73. {
  74. CDialog::DoDataExchange(pDX);
  75. //{{AFX_DATA_MAP(CAboutDlg)
  76. //}}AFX_DATA_MAP
  77. }
  78. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  79. //{{AFX_MSG_MAP(CAboutDlg)
  80. // Keine Nachrichten-Handler
  81. //}}AFX_MSG_MAP
  82. END_MESSAGE_MAP()
  83. // Anwendungsbefehl, um das Dialogfeld aufzurufen
  84. void CStatusBarApp::OnAppAbout()
  85. {
  86. CAboutDlg aboutDlg;
  87. aboutDlg.DoModal();
  88. }
  89. void CStatusBarApp::OnTest() 
  90. {
  91. XPaneText t1("The text in all panes are visible until you close the dialog");
  92. XPaneText t2("P1", 1);
  93. XPaneText t3("P2", 2);
  94. XPaneText t4("P3", 3);
  95. XPaneText t5("P4", 4);
  96. XPaneText t6("P5", 5);
  97. CAboutDlg dlg;
  98. dlg.DoModal();
  99. }