home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Shareware / Programare / skincraft / SkinCrafter_v1.4.12_Demo.msi / _49E29CB9A65AABBF653C1037E1AA74B6 / _5A630F968DDB4C328354F1B62045F04E < prev    next >
Encoding:
Text File  |  2003-09-04  |  2.7 KB  |  120 lines

  1. // ChildFrm.cpp : implementation of the CChildFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "MDIDemo.h"
  6.  
  7. #include "ChildFrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CChildFrame
  17.  
  18. IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
  19.  
  20. BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
  21.     //{{AFX_MSG_MAP(CChildFrame)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code !
  24.         ON_COMMAND(ID_FILE_CLOSE, OnFileClose)
  25.         ON_WM_SETFOCUS()
  26.         ON_WM_CREATE()
  27.     //}}AFX_MSG_MAP
  28. END_MESSAGE_MAP()
  29.  
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CChildFrame construction/destruction
  32.  
  33. CChildFrame::CChildFrame()
  34. {
  35.     // TODO: add member initialization code here
  36.     
  37. }
  38.  
  39. CChildFrame::~CChildFrame()
  40. {
  41. }
  42.  
  43. BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
  44. {
  45.     // TODO: Modify the Window class or styles here by modifying
  46.     //  the CREATESTRUCT cs
  47.  
  48.     if( !CMDIChildWnd::PreCreateWindow(cs) )
  49.         return FALSE;
  50.  
  51.     cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
  52.     cs.lpszClass = AfxRegisterWndClass(0);
  53.  
  54.     return TRUE;
  55. }
  56.  
  57.  
  58.  
  59. /////////////////////////////////////////////////////////////////////////////
  60. // CChildFrame diagnostics
  61.  
  62. #ifdef _DEBUG
  63. void CChildFrame::AssertValid() const
  64. {
  65.     CMDIChildWnd::AssertValid();
  66. }
  67.  
  68. void CChildFrame::Dump(CDumpContext& dc) const
  69. {
  70.     CMDIChildWnd::Dump(dc);
  71. }
  72.  
  73. #endif //_DEBUG
  74.  
  75. /////////////////////////////////////////////////////////////////////////////
  76. // CChildFrame message handlers
  77. void CChildFrame::OnFileClose() 
  78. {
  79.     // To close the frame, just send a WM_CLOSE, which is the equivalent
  80.     // choosing close from the system menu.
  81.  
  82.     SendMessage(WM_CLOSE);
  83. }
  84.  
  85. int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  86. {
  87.     if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
  88.         return -1;
  89.     
  90.     // create a view to occupy the client area of the frame
  91.     if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, 
  92.         CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
  93.     {
  94.         TRACE0("Failed to create view window\n");
  95.         return -1;
  96.     }
  97.  
  98.  
  99.  
  100.     return 0;
  101. }
  102.  
  103. void CChildFrame::OnSetFocus(CWnd* pOldWnd) 
  104. {
  105.     CMDIChildWnd::OnSetFocus(pOldWnd);
  106.  
  107.     m_wndView.SetFocus();
  108. }
  109.  
  110. BOOL CChildFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) 
  111. {
  112.     // let the view have first crack at the command
  113.     if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
  114.         return TRUE;
  115.     
  116.     // otherwise, do default handling
  117.     return CMDIChildWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
  118. }
  119.  
  120.