www.pudn.com > helpview.zip > Filebuff.h, change:1997-10-15,size:5541b


/* 
  
Copyright 1997 Willows Software, Inc.  
 
This library is free software; you can redistribute it and/or 
modify it under the terms of the GNU Library General Public License as 
published by the Free Software Foundation; either version 2 of the 
License, or (at your option) any later version. 
 
This library is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
Library General Public License for more details. 
 
You should have received a copy of the GNU Library General Public 
License along with this library; see the file COPYING.LIB.  If 
not, write to the Free Software Foundation, Inc., 675 Mass Ave, 
Cambridge, MA 02139, USA. 
 
*/ 
 
/************************************************************************* 
* 
* FILEBUFF.H 
* Help file opening, topic buffering, help file buffering routines.      
* 
* Author: Paul E. Kissel 
* 
**************************************************************************/ 
 
#ifndef FILEBUFF_H 
#define FILEBUFF_H 
 
/*********************************** 
** 
**  System Includes 
** 
***********************************/ 
#include <windows.h> 
#include <stdlib.h> 
 
 
/*********************************** 
** 
**  App. Includes 
** 
***********************************/ 
#include "hlpfile.h" 
 
 
/*********************************** 
** 
**  Shared Defines 
** 
***********************************/ 
 
/* Record in the help file data buffer. */ 
typedef struct tagHLPFILEBUFFREC 
{ 
  BOOL     bValid;           /* Is data in record valid. */ 
 
  DWORD    dwTickCount;     /* When file was opened. Used to removed the oldest 
                               help file from the help file buffer. */ 
                                
  /* Key data for record - complete path to the help file. */ 
  char     szHelpFile[ MAX_HLPPATH ];  
 
  HGLOBAL  hHelpFileInfo;   /* Handle to a HLPFILEINFO structure. */ 
 
  HGLOBAL  hTopicBuffer;    /* Handle to a buffer of TOPICBUFFREC structures. */ 
   
} 
HLPFILEBUFFREC; 
typedef HLPFILEBUFFREC * FPHLPFILEBUFFREC; 
 
 
/*  
** Record in hTopicBuffer buffer.  
** 
** Holds processed data for one  
** topic in a help file.  
*/ 
typedef struct tagTOPICBUFFREC 
{ 
  BOOL          bValid;           /* Is data in record valid. */ 
 
  DWORD         dwUsage;          /* How many windows are using this topic. */ 
   
  DWORD         dwTickCount;      /* When topic was last used. Used to removed the oldest 
                                     topic from the buffer. */ 
 
  /* dwTopicCharOffset is key data unique for each record. */ 
  DWORD         dwTopicCharOffset; /* Character offset for the topic's data in the 
                                      |TOPIC file. */ 
 
  HGLOBAL       hTopicElements;   /* Display element data for the non-scrollable part of  
                                         topic. */ 
   
  long          NextTopicCharOffset; /* Character offset for the next browse topic in the 
                                        |TOPIC file. */ 
   
  long          PrevTopicCharOffset; /* Character offset for the prev. browse topic in the 
                                        |TOPIC file. */ 
 
  HGLOBAL       hTopicMacroString;   /* Macro string that is run each time that the topic 
                                        is displayed. */ 
 
  BOOL      bHasNonScrollData;   /* Has non-scrollable window topic data. */ 
  BOOL      bHasScrollData;      /* Has scrollable window topic data. */ 
} 
TOPICBUFFREC; 
typedef TOPICBUFFREC * FPTOPICBUFFREC; 
 
 
/*  
** All available topic information. 
*/ 
typedef struct tagTOPICDATA 
{ 
  /*  
  ** The dwBlock, wOffset, and the hHelpFileInfo->szFileName  
  ** can be used to identify which file and topic's data is stored 
  ** in this structure. 
  */ 
  DWORD     dwTopicCharOffset;    /* Character offset for the topic's data in the 
                                     |TOPIC file. */ 
 
  char      szHelpFile[ MAX_HLPPATH ];  /* Name of help file. */ 
 
  HGLOBAL   hHelpFileInfo;       /* Handle to a HLPFILEINFO structure.     */ 
 
  HGLOBAL   hTopicElements;      /* Display elements for the topic.  */  
             
  long int  NextTopicCharOffset; /* Character offset for the next browse topic in the 
                                    |TOPIC file. */ 
   
  long int  PrevTopicCharOffset; /* Character offset for the prev. browse topic in the 
                                    |TOPIC file. */ 
 
  HGLOBAL   hTopicMacroString;   /* Macro string that is run each time that the topic 
                                    is displayed. */ 
   
  BOOL      bHasNonScrollData;   /* Has non-scrollable window topic data. */ 
  BOOL      bHasScrollData;      /* Has scrollable window topic data. */ 
} 
TOPICDATA; 
typedef TOPICDATA * FPTOPICDATA; 
typedef HGLOBAL HTOPICDATA;                
 
 
/********************************** 
** 
**  Shared Function Prototypes 
** 
***********************************/ 
 
/*********************************** 
** 
**  Shared Function Prototypes 
** 
***********************************/ 
 
HGLOBAL OpenHelpFile( HWND hMainWnd, char * szHelpFilePath ); 
 
BOOL AllocHelpFileBuffer( HWND hMainWnd ); 
void FreeHelpFileBuffer( HWND hMainWnd  ); 
 
HGLOBAL LockTopicData( HWND hMainWnd, char * szHelpFilePath, DWORD dwTopicCharOffset ); 
void UnlockTopicData( HWND hMainWnd, HGLOBAL hTopicData ); 
 
BOOL FileInUse( HWND hMainWnd, char * szHelpFilePath ); 
 
#endif