home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / SAMPLES / DIBVIEW / FILE.H_ / FILE.H
Encoding:
C/C++ Source or Header  |  1993-02-08  |  3.6 KB  |  109 lines

  1.  
  2. #ifndef FILE_INCLUDED
  3. #define FILE_INCLUDED
  4.  
  5. /*--------------  FileOpen Commmon Dialog Box Define ---------------*/
  6.  
  7. #define IDD_INFO            100
  8.  
  9. /*--------------  FileSave Commmon Dialog Box Define ---------------*/
  10.  
  11. #define IDD_FILETYPE        101
  12. #define IDD_RGB             102
  13. #define IDD_RLE4            103
  14. #define IDD_RLE8            104
  15. #define IDD_PM              105
  16. #define IDD_1               106
  17. #define IDD_4               107
  18. #define IDD_8               108
  19. #define IDD_24              109
  20. #define IDD_FILETYPEGROUP   110
  21. #define IDD_BPP             111
  22.  
  23. /*--------------  Dib Information Dialog Box Defines ---------------*/
  24.  
  25. #define IDD_NAME            200
  26. #define IDD_FORMAT          201
  27. #define IDD_WIDTH           202
  28. #define IDD_HEIGHT          203
  29. #define IDD_COLORS          204
  30. #define IDD_COMPRESS        205
  31. #define IDD_COMPHEAD        206
  32.  
  33.  
  34. /*--------------  DIB header Marker Define -------------------------*/
  35.  
  36. #define DIB_HEADER_MARKER   ((WORD) ('M' << 8) | 'B')
  37.  
  38.  
  39. /*--------------  MyRead Function Define ---------------------------*/
  40.  
  41. // When we read in a DIB, we read it in in chunks.  We read half a segment
  42. //  at a time.  This way we insure that we don't cross any segment
  43. //  boundries in _lread() during a read.  We don't read in a full segment
  44. //  at a time, since _lread takes some "int" type parms instead of
  45. //  WORD type params (it'd work, but the compiler would give you warnings)...
  46.  
  47. #define BYTES_PER_READ  32767
  48.  
  49. /*--------------  Define for PM DIB  -------------------------------*/
  50. // The constants for RGB, RLE4, RLE8 are already defined inside
  51. // of Windows.h
  52.  
  53. #define BI_PM       3L
  54.  
  55.  
  56. /*-------------- Magic numbers -------------------------------------*/
  57. // Maximum length of a filename for DOS is 128 characters.
  58.  
  59. #define MAX_FILENAME 129
  60.  
  61.  
  62. /*--------------  TypeDef Structures -------------------------------*/
  63.  
  64. typedef struct InfoStruct
  65.   {
  66.   char  szName[13];
  67.   char  szType[15];
  68.   DWORD cbWidth;
  69.   DWORD cbHeight;
  70.   DWORD cbColors;
  71.   char  szCompress[5];
  72.   }  INFOSTRUCT;
  73.  
  74. typedef WORD (CALLBACK* FARHOOK)(HWND,UINT,WPARAM,LPARAM);
  75. /*--------------  Global Variables ---------------------------------*/
  76.  
  77. extern char szFileName[256];        // Filename of DIB (valid iff (hDIB))
  78. extern char szDirName[256];         // Directory Name
  79. #define DIRNAMESIZE 256
  80. WORD   wDibType;                    // Type of Dib
  81. DWORD  biStyle;                     // Type of Dib - RGB, RLE4, RLE8, PM
  82. WORD   biBits;                      // bits per pixel
  83.  
  84. /*--------------  Local Function Prototypes ------------------------*/
  85.  
  86. HANDLE   OpenDIBFile       (LPSTR szFileName);
  87. BOOL     GetFileName       (LPSTR, WORD);
  88. HANDLE   ReadDIBFile       (int);
  89. BOOL     MyRead            (int, LPSTR, DWORD);
  90. int      CheckIfFileExists (char *);
  91. int      GetDibInfo        (char *, INFOSTRUCT *);
  92. BOOL     SaveDIBFile       (void);
  93. WORD     ExtractDibType    (INFOSTRUCT *);
  94. WORD     ExtractDibBits    (INFOSTRUCT *);
  95. HANDLE   WinDibFromBitmap  (HBITMAP, DWORD, WORD, HPALETTE);
  96. HANDLE   PMDibFromBitmap   (HBITMAP, DWORD, WORD, HPALETTE);
  97. BOOL     WriteDIB          (LPSTR, HANDLE);
  98. VOID     ParseCommandLine  (LPSTR);
  99. HANDLE   GetDIB            (void);
  100. DWORD PASCAL lwrite        (int, VOID FAR *, DWORD);
  101.  
  102. /*--------------  Exported Function Prototypes ---------------------*/
  103.  
  104. BOOL FAR PASCAL __export FileOpenHookProc (HWND, WORD, WORD, LONG);
  105. BOOL FAR PASCAL __export FileSaveHookProc (HWND, WORD, WORD, LONG);
  106. BOOL FAR PASCAL __export InfoDlgProc      (HWND, WORD, WORD, LONG);
  107.  
  108. #endif // FILE_INCLUDED
  109.