home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / leadtools / ocx32.lt / Magndoc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-10  |  2.2 KB  |  99 lines

  1. // magnDoc.cpp : implementation of the CMagnifyDoc class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "magnify.h"
  6.  
  7. #include "magnDoc.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. extern CMagnifyApp theApp;
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CMagnifyDoc
  19.  
  20. IMPLEMENT_DYNCREATE(CMagnifyDoc, CDocument)
  21.  
  22. BEGIN_MESSAGE_MAP(CMagnifyDoc, CDocument)
  23.     //{{AFX_MSG_MAP(CMagnifyDoc)
  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. END_MESSAGE_MAP()
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CMagnifyDoc construction/destruction
  31.  
  32. static const WCHAR BASED_CODE _szLicString[] =
  33.     L"LEADTOOLS OCX Copyright (c) 1998 LEAD Technologies, Inc.";
  34.  
  35. CMagnifyDoc::CMagnifyDoc()
  36. {
  37.     BSTR lpLic = SysAllocString(_szLicString);
  38.     m_Lead.Create("", 0, CRect(0,0,1,1), theApp.m_pMainWnd, 0,NULL,FALSE,lpLic);
  39.     m_Lead.ShowWindow(SW_HIDE);
  40.     SysFreeString(lpLic);
  41.     UNLOCKSUPPORT(m_Lead);
  42. }
  43.  
  44. CMagnifyDoc::~CMagnifyDoc()
  45. {
  46.     if( IsWindow(m_Lead.m_hWnd) )
  47.         m_Lead.DestroyWindow();
  48. }
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CMagnifyDoc serialization
  52.  
  53. void CMagnifyDoc::Serialize(CArchive& ar)
  54. {
  55.     if (ar.IsStoring())
  56.     {
  57.         // TODO: add storing code here
  58.     }
  59.     else
  60.     {
  61.         // TODO: add loading code here
  62.     }
  63. }
  64.  
  65. /////////////////////////////////////////////////////////////////////////////
  66. // CMagnifyDoc diagnostics
  67.  
  68. #ifdef _DEBUG
  69. void CMagnifyDoc::AssertValid() const
  70. {
  71.     CDocument::AssertValid();
  72. }
  73.  
  74. void CMagnifyDoc::Dump(CDumpContext& dc) const
  75. {
  76.     CDocument::Dump(dc);
  77. }
  78. #endif //_DEBUG
  79.  
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CMagnifyDoc commands
  82.  
  83. BOOL CMagnifyDoc::OnOpenDocument(LPCTSTR lpszPathName) 
  84. {
  85.     int nRet;
  86.    if( lpszPathName )
  87.    {
  88.          nRet = m_Lead.Load(lpszPathName, 0,1,1);
  89.       if( nRet )
  90.       {
  91.          theApp.DisplayLEADError(nRet);
  92.          return FALSE;
  93.       }
  94.       return TRUE;
  95.    }
  96.    else
  97.       return FALSE;
  98. }
  99.