home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / VFORM.ZIP / Samples / vfHex / VfHexDoc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-10  |  2.7 KB  |  91 lines

  1. // -------------------------------------------------------------------------
  2. // Copyright @ 1997 TCK Software, Incorporated
  3. // All Rights Reserved
  4. // -------------------------------------------------------------------------
  5.  
  6. // VfHexDoc.h : interface of the CVfHexDoc class
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9.  
  10. #if !defined(AFX_VFHEXDOC_H__ACB394C5_9D36_11D1_88FB_00A0C9050951__INCLUDED_)
  11. #define AFX_VFHEXDOC_H__ACB394C5_9D36_11D1_88FB_00A0C9050951__INCLUDED_
  12.  
  13. #if _MSC_VER >= 1000
  14. #pragma once
  15. #endif // _MSC_VER >= 1000
  16.  
  17. #define MAX_RECSIZE        1024
  18.  
  19. class CVfHexDoc : public CDocument
  20. {
  21. protected: // create from serialization only
  22.     CVfHexDoc();
  23.     DECLARE_DYNCREATE(CVfHexDoc)
  24.     FILE*    m_fdFile;
  25.  
  26.     CString        m_fileName;            // File Name
  27.     short        m_nRecSize;            // Size of one record
  28.     long        m_nOffset;            // Offset to first record
  29.     long        m_nRecId;            // Current record Id (in m_recData)
  30.     char        m_recData[MAX_RECSIZE + 1];
  31.  
  32.     long        m_nFileSize;        // Size of current file
  33.  
  34. // Attributes
  35. public:
  36.     LPCSTR        FileName()            { return m_fileName; }
  37.     int            RecSize()            { return m_nRecSize; }
  38.     long        Offset()            { return m_nOffset; }
  39.  
  40.     long        FileSize()            { return m_nFileSize; }
  41.     long        RecCount();            // rounds Down
  42.     long        RecCountHigh();        // rounds UP
  43.     LPCSTR        RecData()            { return m_recData; }
  44.  
  45.     void        FileName(LPCSTR x)    { m_fileName = x; }
  46.     void        RecSize(int x)        { m_nRecSize = x; }
  47.     void        Offset(long x)        { m_nOffset = x; }
  48.  
  49. // Operations
  50. public:
  51.     void InitTB();                        // Initialize Toolbar values
  52.     CWnd* GetTbCtl(UINT nCtlId);        // Get a toolbar control
  53.     BOOL ReadRecord(long nRecId);        // read 1 record from file
  54.     void UseNewFile(LPCSTR szFileName);    // Initialize/open a new file
  55.  
  56. // Overrides
  57.     // ClassWizard generated virtual function overrides
  58.     //{{AFX_VIRTUAL(CVfHexDoc)
  59.     public:
  60.     virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  61.     //}}AFX_VIRTUAL
  62.  
  63. // Implementation
  64. public:
  65.     virtual ~CVfHexDoc();
  66. #ifdef _DEBUG
  67.     virtual void AssertValid() const;
  68.     virtual void Dump(CDumpContext& dc) const;
  69. #endif
  70.  
  71. protected:
  72.  
  73. // Generated message map functions
  74. protected:
  75.     //{{AFX_MSG(CVfHexDoc)
  76.         // NOTE - the ClassWizard will add and remove member functions here.
  77.         //    DO NOT EDIT what you see in these blocks of generated code !
  78.     afx_msg void OnTbSelect();
  79.     afx_msg void OnTbRecsizeChanged();
  80.     afx_msg void OnTbOffsetChanged();
  81.     //}}AFX_MSG
  82.     DECLARE_MESSAGE_MAP()
  83. };
  84.  
  85. /////////////////////////////////////////////////////////////////////////////
  86.  
  87. //{{AFX_INSERT_LOCATION}}
  88. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  89.  
  90. #endif // !defined(AFX_VFHEXDOC_H__ACB394C5_9D36_11D1_88FB_00A0C9050951__INCLUDED_)
  91.