home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / chap07 / fragment / fragment.h < prev    next >
C/C++ Source or Header  |  1995-05-03  |  2KB  |  62 lines

  1. /*
  2.  * FRAGMENT.H
  3.  * Fragmented File Generator Chapter 7
  4.  *
  5.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  6.  *
  7.  * Kraig Brockschmidt, Microsoft
  8.  * Internet  :  kraigb@microsoft.com
  9.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  10.  */
  11.  
  12.  
  13. #ifndef _FRAGMENT_H_
  14. #define _FRAGMENT_H_
  15.  
  16.  
  17. #define INC_OLE2
  18. #define CHAPTER7
  19. #include <inole.h>
  20. #include <string.h>
  21.  
  22. #define CSTREAMS    26
  23. #define CCHPATHMAX  256
  24.  
  25.  
  26. class CFragment
  27.     {
  28.     private:
  29.         BOOL        m_fInitialized;         //CoInitilize?
  30.         IMalloc    *m_pIMalloc;             //Task allocator
  31.         char       *m_pch;                  //Char array (8 bits)
  32.         TCHAR      *m_pszScratch;           //Scratch space
  33.  
  34.         UINT        m_cch;                  //Stream size
  35.         UINT        m_cStreams;             //Stream count
  36.         TCHAR       m_szFile[CCHPATHMAX];   //File in use
  37.  
  38.         HCURSOR     m_hCur;                 //Saved cursor
  39.  
  40.  
  41.     public:
  42.         CFragment::CFragment(void);
  43.         CFragment::~CFragment(void);
  44.  
  45.         BOOL        Init(void);
  46.         BOOL        AllocCharArrays(void);
  47.         BOOL        CreateFragmentedFile(void);
  48.         void        FreeSpaceInFile(void);
  49.         void        DefragmentFile(void);
  50.  
  51.     private:
  52.         void        StreamCreate(IStorage *, UINT, IStream **);
  53.         void        Message(LPTSTR);
  54.  
  55.        #ifndef WIN32
  56.         //Substitute for Win32 MoveFile under Win16
  57.         void        MyMoveFile(char *, char *);
  58.        #endif
  59.     };
  60.  
  61. #endif //_FRAGMENT_H_
  62.