home *** CD-ROM | disk | FTP | other *** search
/ distrib.akp.su/Programming/Vb-6+Rus/ / distrib.akp.su.tar / distrib.akp.su / Programming / Vb-6+Rus / COMMON / MSDEV98 / BIN / IDE / PROPSHT.DLL / TEMPLATE / 22330 < prev    next >
Text File  |  1998-06-18  |  3KB  |  99 lines

  1. // $$VAL:FRAMEIMPLEMENTATION$$ : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "$$VAL:RESINC$$"
  6. #include "$$VAL:FRAMEHEADER$$"
  7.  
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char BASED_CODE THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // $$VAL:FRAMECLASS$$
  15.  
  16. IMPLEMENT_DYNCREATE($$VAL:FRAMECLASS$$, CMiniFrameWnd)
  17.  
  18. $$VAL:FRAMECLASS$$::$$VAL:FRAMECLASS$$()
  19. {
  20.     m_pModelessPropSheet = NULL;
  21. }
  22.  
  23. $$VAL:FRAMECLASS$$::~$$VAL:FRAMECLASS$$()
  24. {
  25. }
  26.  
  27.  
  28. BEGIN_MESSAGE_MAP($$VAL:FRAMECLASS$$, CMiniFrameWnd)
  29.     //{{AFX_MSG_MAP($$VAL:FRAMECLASS$$)
  30.     ON_WM_CREATE()
  31.     ON_WM_CLOSE()
  32.     ON_WM_SETFOCUS()
  33.     ON_WM_ACTIVATE()
  34.     //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36.  
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // $$VAL:FRAMECLASS$$ message handlers
  40.  
  41. int $$VAL:FRAMECLASS$$::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  42. {
  43.     if (CMiniFrameWnd::OnCreate(lpCreateStruct) == -1)
  44.         return -1;
  45.     
  46.     m_pModelessPropSheet = new $$VAL:SHEETCLASS$$(this);
  47.     if (!m_pModelessPropSheet->Create(this, 
  48.         WS_CHILD | WS_VISIBLE, 0))
  49.     {
  50.         delete m_pModelessPropSheet;
  51.         m_pModelessPropSheet = NULL;
  52.         return -1;
  53.     }
  54.  
  55.     // Resize the mini frame so that it fits around the child property
  56.     // sheet.
  57.     CRect rectClient, rectWindow;
  58.     m_pModelessPropSheet->GetWindowRect(rectClient);
  59.     rectWindow = rectClient;
  60.  
  61.     // CMiniFrameWnd::CalcWindowRect adds the extra width and height
  62.     // needed from the mini frame.
  63.     CalcWindowRect(rectWindow);
  64.     SetWindowPos(NULL, rectWindow.left, rectWindow.top,
  65.         rectWindow.Width(), rectWindow.Height(),
  66.         SWP_NOZORDER | SWP_NOACTIVATE);
  67.     m_pModelessPropSheet->SetWindowPos(NULL, 0, 0,
  68.         rectClient.Width(), rectClient.Height(),
  69.         SWP_NOZORDER | SWP_NOACTIVATE);
  70.  
  71.     return 0;
  72. }
  73.  
  74. void $$VAL:FRAMECLASS$$::OnClose() 
  75. {
  76.     // Instead of closing the modeless property sheet, just hide it.
  77.     ShowWindow(SW_HIDE);
  78. }
  79.  
  80. void $$VAL:FRAMECLASS$$::OnSetFocus(CWnd* pOldWnd) 
  81. {
  82.     CMiniFrameWnd::OnSetFocus(pOldWnd);
  83. }
  84.  
  85. void $$VAL:FRAMECLASS$$::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) 
  86. {
  87.     CMiniFrameWnd::OnActivate(nState, pWndOther, bMinimized);
  88.  
  89.     // Forward any WM_ACTIVATEs to the property sheet...
  90.     // Like the dialog manager itself, it needs them to save/restore the focus.
  91.     ASSERT_VALID(m_pModelessPropSheet);
  92.  
  93.     // Use GetCurrentMessage to get unmodified message data.
  94.     const MSG* pMsg = GetCurrentMessage();
  95.     ASSERT(pMsg->message == WM_ACTIVATE);
  96.     m_pModelessPropSheet->SendMessage(pMsg->message, pMsg->wParam,
  97.         pMsg->lParam);
  98. }
  99.