home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Unleashed
/
Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso
/
repease
/
rvb.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-14
|
27KB
|
745 lines
/*==============================================================================
RVB.V
Visual Basic VBX shell for the TER DLL
Version 4.0
===========
Sub Systems, Inc.
Software License Agreement (1994)
----------------------------------
This license agreement allows the purchaser the right to modify the
source code to incorporate in an application larger than the editor itself.
The target application must not be a programmer's utility 'like' a text editor.
Sub Systems, Inc. reserves the right to prosecute anybody found to be
making illegal copies of the executable software or compiling the source
code for the purpose of selling there after.
===============================================================================*/
#define STRICT
#include "windows.h"
#include "stdio.h"
#include "stdlib.h"
#include "ctype.h"
#include "dos.h"
#include "fcntl.h"
#include "io.h"
#include "sys\types.h"
#include "sys\stat.h"
#include "string.h"
#include "vbapi.h"
#if defined(__TURBOC__)
#include "alloc.h"
#include "mem.h"
#define _fmemmove memmove
#else
#include "malloc.h"
#include "memory.h"
#define farmalloc _fmalloc
#define farrealloc _frealloc
#define farfree _ffree
#endif
#include "rep.h"
#define PREFIX
#include "rvb.h"
/******************************************************************************
VBINITCC: Visual Basic control intialization function
******************************************************************************/
BOOL WINAPI _export VBINITCC(USHORT usVersion, BOOL rRuntime)
{
return VBRegisterModel(hRvbInst,&model);
}
/******************************************************************************
RepCtlProc: Control Proceedure
******************************************************************************/
LONG WINAPI _export RepCtlProc(HCTL hCtl, HWND hWnd, USHORT message, USHORT wParam, LONG lParam)
{
LPCTL pCtl;
pCtl=(LPCTL)VBDerefControl(hCtl);
switch (message) {
case VBM_INITIALIZE: // initialize the properties
FarMemSet(pCtl,0,sizeof(struct StrCtl));
GetBitmapDim(pCtl);
return NULL; // processed
case VBM_CREATED:
if (VBGetMode()!=MODE_DESIGN) return 0L;
break;
case WM_SIZE:
// snap to the old size
SetWindowPos(hWnd,NULL,0,0,pCtl->width,pCtl->height, SWP_NOMOVE | SWP_NOZORDER);
break;
case WM_PAINT:
if (VBGetMode()==MODE_DESIGN) PaintControl(pCtl, hWnd);
break;
case REP_CLOSE: // report close message
VBFireEvent(hCtl,IEVENT_UNLOAD,NULL);
break;
default:
break;
}
return VBDefControlProc(hCtl, hWnd, message, wParam, lParam);
}
/****************************************************************************
RvbForm:
This routine fills the StrForm structure with the pointers for the
field selection and field field verication functions. It then calls
the 'form' function in the REP.DLL.
The function returns a 0 if successful, otherwise it returns an error code.
see ERR_ in rew.h file.
*****************************************************************************/
int WINAPI _export RvbForm(struct StrForm far *FormParam)
{
// fill in the call back function addresses
FormParam->UserSelection=(USER_SELECTION)MakeProcInstance((FARPROC)RvbFieldSelection,hRvbInst); // field selection routine
FormParam->VerifyField=(VERIFY_FIELD)MakeProcInstance((FARPROC)RvbVerifyField,hRvbInst); // field verification routine
if (!FormParam->UserSelection || !FormParam->VerifyField) return ERR_OTHER;
return form(FormParam); // call the form editor
}
/****************************************************************************
RvbInit:
Initialize the report executor
*****************************************************************************/
int WINAPI _export RvbInit(HWND hWnd, struct StrRep far *rep)
{
int result;
HCTL hCtl;
LPCTL pCtl;
if (hWnd!=rep->hParentWnd) {
MessageBox(NULL,"Invalid Control Handle!",NULL,MB_OK);
return ERR_OTHER;
}
rep->DrawPicture=(DRAW_PICTURE)MakeProcInstance((FARPROC)RvbDrawPicture,hRvbInst); // picture drawing routine
result = RepInit(rep);
// save the field pointers
if (result==0) { // successful return
// Get the control handle and data area
if (NULL==(hCtl=VBGetHwndControl(hWnd))) return ERR_OTHER;
pCtl=(LPCTL)VBDerefControl(hCtl);
pCtl->DataField=rep->field;
pCtl->SortField=rep->SortField;
pCtl->TotalFields=rep->TotalFields;
pCtl->TotalSortFields=rep->TotalSortFields;
}
return result;
}
/****************************************************************************
RvbRec:
Pass the record to the report executor
*****************************************************************************/
int WINAPI _export RvbRec(HWND hWnd)
{
return RepRec();
}
/****************************************************************************
RvbExit:
Close the report executor
*****************************************************************************/
int WINAPI _export RvbExit(HWND hWnd)
{
return RepExit();
}
/****************************************************************************
RvbSetTextField:
Set the data for the specified text field
*****************************************************************************/
int WINAPI _export RvbSetTextField(HWND hWnd, int FieldNo, LPSTR text,int TextLen)
{
int i;
HCTL hCtl;
LPCTL pCtl;
struct StrField huge *field;
// Get the control handle and data area
if (NULL==(hCtl=VBGetHwndControl(hWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
field=pCtl->DataField;
if (!field || FieldNo<0 || FieldNo>=pCtl->TotalFields) return FALSE;
if (field[FieldNo].source!=SRC_APPL) return FALSE; // not an application data field
if (field[FieldNo].type!=TYPE_TEXT) return FALSE; // not a text field
// copy the field
if (TextLen>field[FieldNo].width) TextLen=field[FieldNo].width;
if (TextLen<0) TextLen=0;
for (i=0;i<TextLen;i++) field[FieldNo].CharData[i]=text[i];
field[FieldNo].CharData[TextLen]=0; // NULL terminate the string
return TRUE;
}
/****************************************************************************
RvbSetNumField:
Set the data for the specified numeric, logical or date type field
*****************************************************************************/
int WINAPI _export RvbSetNumField(HWND hWnd, int FieldNo, long NumData)
{
HCTL hCtl;
LPCTL pCtl;
struct StrField huge *field;
// Get the control handle and data area
if (NULL==(hCtl=VBGetHwndControl(hWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
field=pCtl->DataField;
if (!field || FieldNo<0 || FieldNo>=pCtl->TotalFields) return FALSE;
if (field[FieldNo].source!=SRC_APPL) return FALSE; // not an application data field
if (field[FieldNo].type!=TYPE_NUM
&& field[FieldNo].type!=TYPE_LOGICAL
&& field[FieldNo].type!=TYPE_PICT
&& field[FieldNo].type!=TYPE_DATE) return FALSE; // not a numeric field
// copy the field
field[FieldNo].NumData=NumData;
return TRUE;
}
/****************************************************************************
RvbSetDoubleField:
Set the data for the specified double field
*****************************************************************************/
int WINAPI _export RvbSetDoubleField(HWND hWnd, int FieldNo, double DblData)
{
HCTL hCtl;
LPCTL pCtl;
struct StrField huge *field;
// Get the control handle and data area
if (NULL==(hCtl=VBGetHwndControl(hWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
field=pCtl->DataField;
if (!field || FieldNo<0 || FieldNo>=pCtl->TotalFields) return FALSE;
if (field[FieldNo].source!=SRC_APPL) return FALSE; // not an application data field
if (field[FieldNo].type!=TYPE_DBL) return FALSE; // not a double numeric field
// copy the field
field[FieldNo].DblData=DblData;
return TRUE;
}
/****************************************************************************
RvbGetDataField:
Returns the specified data field
*****************************************************************************/
int WINAPI _export RvbGetDataField(HWND hWnd, int FieldNo, struct StrField far *field)
{
HCTL hCtl;
LPCTL pCtl;
// Get the control handle and data area
if (NULL==(hCtl=VBGetHwndControl(hWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
if (!(pCtl->DataField) || FieldNo<0 || FieldNo>=pCtl->TotalFields) return FALSE;
// get the current field structure from the control area
FarMove(&(pCtl->DataField[FieldNo]),field,sizeof(struct StrField));
return TRUE;
}
/****************************************************************************
RvbGetSortField:
Returns the specified sort field
*****************************************************************************/
int WINAPI _export RvbGetSortField(HWND hWnd, int FieldNo, struct StrField far *field)
{
HCTL hCtl;
LPCTL pCtl;
// Get the control handle and data area
if (NULL==(hCtl=VBGetHwndControl(hWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
if (!(pCtl->SortField) || FieldNo<0 || FieldNo>=pCtl->TotalSortFields) return FALSE;
// get the current field structure from the control area
FarMove(&(pCtl->SortField[FieldNo]),field,sizeof(struct StrField));
return TRUE;
}
/****************************************************************************
RvbGetFormField:
Get the current field. This function return TRUE when successful.
*****************************************************************************/
int WINAPI _export RvbGetFormField(HWND hWnd, struct StrField far *field, int far *SortLevel)
{
HCTL hCtl;
LPCTL pCtl;
// Get the control handle and data area
if (NULL==(hCtl=VBGetHwndControl(hWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
// get the current field structure from the control area
FarMove(&(pCtl->CurField),field,sizeof(struct StrField));
(*SortLevel)=pCtl->SortLevel;
return TRUE;
}
/****************************************************************************
RvbSetFormField:
Set the current field to the specified field structure.
This function return TRUE when successful.
*****************************************************************************/
int WINAPI _export RvbSetFormField(HWND hWnd, struct StrField far *field, int valid)
{
HCTL hCtl;
LPCTL pCtl;
// Get the control handle and data area
if (NULL==(hCtl=VBGetHwndControl(hWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
// set the current field structure from the use area
FarMove(field,&(pCtl->CurField),sizeof(struct StrField));
pCtl->valid=valid; // TRUE for a valid field
return TRUE;
}
/****************************************************************************
RvbGetPictureInfo:
Get the information to draw a picture
*****************************************************************************/
int WINAPI _export RvbGetPictureInfo(HWND hWnd, struct StrPict far *pict)
{
HCTL hCtl;
LPCTL pCtl;
// Get the control handle and data area
if (NULL==(hCtl=VBGetHwndControl(hWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
// transfer the picture information structure
(*pict)=pCtl->pict;
return TRUE;
}
/****************************************************************************
RvbDrawBitmap:
Draw the specified part of a specified bitmap to the current report output
device context. This function is called by a visual basic application
within the DrawPicture event handler.
The picture X location and width parameters are specified in percentage of
width. The picture Y location and height parameters are specified in
percentage of height.
*****************************************************************************/
int WINAPI _export RvbDrawBitmap(HWND hWnd, HWND hBMWnd, HBITMAP hBM,int x, int y, int width, int height)
{
HCTL hCtl;
LPCTL pCtl;
BITMAP bm;
HANDLE hInfo,hImage; // handle to the device independent bitmap
LPSTR pImage; // pointer to the image data
LPBITMAPINFOHEADER pInfo; // pointer to the image header data
DWORD InfoSize,ImageSize;
int SourceX,SourceY,SourceWidth,SourceHeight;
// Get the control handle and data area
if (NULL==(hCtl=VBGetHwndControl(hWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
if (!(pCtl->pict.hDC)) return FALSE; // device context not available
// extract the device independent bits from the bitmap
GetObject(hBM,sizeof(BITMAP),(LPSTR)&bm); // get the dimension of bit map
//********** create the device independent bitmap ***********************
InfoSize=sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD); // create a 256 color bitmap structure
if (NULL==(hInfo=GlobalAlloc(GMEM_MOVEABLE,InfoSize))
||NULL==(pInfo=(LPBITMAPINFOHEADER)GlobalLock(hInfo)) ) {
MessageBox(hWnd,"Ran out of memory for Bitmap Info!",NULL,MB_OK);
return FALSE;
}
//***** fill in the info structure ******
pInfo->biSize=sizeof(BITMAPINFOHEADER);
pInfo->biWidth=bm.bmWidth;
pInfo->biHeight=bm.bmHeight;
pInfo->biPlanes=1; // DIB have plane = 1
pInfo->biBitCount=8; // 8 bits per pixel or color
pInfo->biCompression=BI_RGB; // no compression
pInfo->biSizeImage=0; // initialize to zero
pInfo->biXPelsPerMeter=0;
pInfo->biYPelsPerMeter=0;
pInfo->biClrUsed=0; // depends on biBitCount
pInfo->biClrImportant=0; // all colors important
if (!GetDIBits(GetDC(hBMWnd),hBM,0,bm.bmHeight,NULL,(LPBITMAPINFO)pInfo,DIB_RGB_COLORS)) {
MessageBox(hWnd,"Error Creating Device Independent Bitmap Structure!",NULL,MB_OK);
return FALSE;
}
ImageSize=pInfo->biSizeImage;
if (NULL==(hImage=GlobalAlloc(GMEM_MOVEABLE,ImageSize))
||NULL==(pImage=GlobalLock(hImage)) ) {
MessageBox(hWnd,"Ran out of memory for Bitmap Image!",NULL,MB_OK);
return FALSE;
}
if (!GetDIBits(GetDC(hBMWnd),hBM,0,bm.bmHeight,pImage,(LPBITMAPINFO)pInfo,DIB_RGB_COLORS)) {
MessageBox(hWnd,"Error Creating Device Independent Bitmap Image!",NULL,MB_OK);
return FALSE;
}
// Convert percentage to pixel values
SourceX=(int)((((long)bm.bmWidth*x))/(100L));
SourceY=(int)((((long)bm.bmHeight*y))/(100L));
SourceWidth=(int)((((long)bm.bmWidth*width))/(100L));
SourceHeight=(int)((((long)bm.bmHeight*height))/(100L));
// copy the bitmap
StretchDIBits(pCtl->pict.hDC,pCtl->pict.x,pCtl->pict.y,pCtl->pict.width,pCtl->pict.height,
SourceX,SourceY,SourceWidth,SourceHeight,pImage,(LPBITMAPINFO)pInfo,DIB_RGB_COLORS,SRCCOPY);
// release the resources
GlobalUnlock(hImage);
GlobalUnlock(hInfo);
GlobalFree(hImage);
GlobalFree(hInfo);
return TRUE;
}
/******************************************************************************
RvbFieldSelection:
This routine is called by the REP_FLD module to allow user to select
a data field.
This routine will file FieldSelection event to the parent control.
The parent control gets the input field structure, and fills in the
required field.
******************************************************************************/
int WINAPI _export RvbFieldSelection(HWND hWnd,struct StrField huge *field,int SortLevel)
{
HCTL hCtl;
HWND hCtlWnd;
LPCTL pCtl;
// Get the control handle and data area
if (NULL==(hCtlWnd=RepGetParent())) return FALSE;
if (NULL==(hCtl=VBGetHwndControl(hCtlWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
// Save the current field structure in the control area
field->name[0]=0; // reset the field name
FarMove(field,&(pCtl->CurField),sizeof(struct StrField));
pCtl->SortLevel=SortLevel;
pCtl->valid=FALSE;
// fire the field selection event
VBFireEvent(hCtl,IEVENT_SELECT_FIELD,NULL);
// return the modified field structure
pCtl=(LPCTL)VBDerefControl(hCtl); // refresh the pointer
if (pCtl->valid) FarMove(&(pCtl->CurField),field,sizeof(struct StrField));
return pCtl->valid;
}
/******************************************************************************
RvbVerifyField:
This routine will fire FieldVerification event to the parent control.
The parent control gets the input field structure, and verifies the field
name.
The function returns TRUE if the field is valid, otherwise it returns
a FALSE value.
******************************************************************************/
int WINAPI _export RvbVerifyField(struct StrField huge *field,int SortLevel)
{
HCTL hCtl;
HWND hCtlWnd;
LPCTL pCtl;
// Get the control handle and data area
if (NULL==(hCtlWnd=RepGetParent())) return FALSE;
if (NULL==(hCtl=VBGetHwndControl(hCtlWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
// Save the current field structure in the control area
FarMove(field,&(pCtl->CurField),sizeof(struct StrField));
pCtl->SortLevel=SortLevel;
pCtl->valid=FALSE;
// fire the field selection event
VBFireEvent(hCtl,IEVENT_VERIFY_FIELD,NULL);
// return the validation flag
pCtl=(LPCTL)VBDerefControl(hCtl); // refresh the pointer
if (pCtl->valid) FarMove(&(pCtl->CurField),field,sizeof(struct StrField));
return pCtl->valid;
}
/******************************************************************************
RvbDrawPicture:
This routine is called by the report executor to draw a specified
picture type field. The first argument specifies the device context
of the reporting device. If the report output is directed to a printer,
this device context belongs to a printer, otherwise it specifies a
device context for a metafile. You application should draw the picture
on this device context within the specified rectangle (last argument).
The device context is in ANISOTROPIC mode. The resolution in the X and
Y direction is given by the UNITS_PER_INCH constant.
The second argument is the picture id. The third and fourth arguments
are the file and field id for the picture field.
The function returns TRUE if successful.
In this demo program, this routine draws a logo for a given picture id.
This program uses only one bitmap, and draws different part of the same
bitmap for different picture id.
******************************************************************************/
int WINAPI _export RvbDrawPicture(HDC hDC,int PictId, int FileId, int FieldId, RECT far * rect)
{
HCTL hCtl;
HWND hCtlWnd;
LPCTL pCtl;
// Get the control handle and data area
if (NULL==(hCtlWnd=RepGetParent())) return FALSE;
if (NULL==(hCtl=VBGetHwndControl(hCtlWnd))) return FALSE;
pCtl=(LPCTL)VBDerefControl(hCtl);
// save the arguments
pCtl->pict.hDC=hDC;
pCtl->pict.PictId=PictId;
pCtl->pict.FileId=FileId;
pCtl->pict.FieldId=FieldId;
pCtl->pict.x = rect->left;
pCtl->pict.y = rect->top;
pCtl->pict.width = rect->right-rect->left;
pCtl->pict.height = rect->bottom-rect->top;
// fire the picture draw event
VBFireEvent(hCtl,IEVENT_DRAW_PICTURE,NULL);
// reset the hDC parameter
pCtl=(LPCTL)VBDerefControl(hCtl);
pCtl->pict.hDC=0;
return TRUE;
}
/******************************************************************************
LibMain: Function to initialize DLL
******************************************************************************/
int CALLBACK LibMain(HINSTANCE hInstance, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine)
{
// Initialize the common global variables
hRvbInst=hInstance;
// fill the model structure
model.usVersion=VB_VERSION; // visual basic version supported
model.fl=MODEL_fArrows|MODEL_fFocusOk|MODEL_fInitMsg;
model.pctlproc=(PCTLPROC) RepCtlProc;
model.fsClassStyle=0; // allocate a DC for this class
model.flWndStyle=0; // window styles
model.cbCtlExtra=sizeof(struct StrCtl); // size to hold a pointer
model.idBmpPalette=IDR_TOOLBAR_UP;// first resource id for the icon
model.npszDefCtlName="Rep"; // control name
model.npszClassName="ReportEasePlus";// class name
model.npszParentClassName=NULL; // parent class
model.npproplist=RvbProp; // near pointer to the near property pointers
model.npeventlist=RvbEvent; // near pointer to the near event pointers
model.nDefProp=0; // index of the default property
model.nDefEvent=0; // index of the default event
model.nValueProp=0xFF; // default property for asignement
model.usCtlVersion=20; // V2.0 of REP
return TRUE;
}
/*****************************************************************************
PaintControl:
Paint the control from the bitmap
******************************************************************************/
PaintControl(LPCTL pCtl, HWND hWnd)
{
HBITMAP hBM,hOldBM;
HDC hMemDC;
PAINTSTRUCT ps;
// get the bitmap
if (NULL==(hBM=LoadBitmap(hRvbInst,MAKEINTRESOURCE(IDR_TOOLBAR_UP)))) return FALSE;
BeginPaint(hWnd,&ps);
if (NULL==(hMemDC=CreateCompatibleDC(ps.hdc))) return NULL;
hOldBM=SelectObject(hMemDC,hBM);
// display the bitmap
BitBlt(ps.hdc,0,0,pCtl->width,pCtl->height,hMemDC,0,0,SRCCOPY);
// delete the resources
SelectObject(hMemDC,hOldBM); // release the bitmap
DeleteObject(hBM);
DeleteDC(hMemDC);
EndPaint(hWnd,&ps);
return TRUE;
}
/*****************************************************************************
GetBitmapDim:
Get the dimension of the icon bitmap
******************************************************************************/
GetBitmapDim(LPCTL pCtl)
{
HBITMAP hBM;
BITMAP bm;
// set a small dimension for the bitmap
pCtl->width=pCtl->height=100;
if (NULL==(hBM=LoadBitmap(hRvbInst,MAKEINTRESOURCE(IDR_TOOLBAR_UP)))) return FALSE;
// get the bitmap dimensions
GetObject(hBM,sizeof(BITMAP),(LPSTR)&bm); // get the dimension of bit map
pCtl->width=bm.bmWidth;
pCtl->height=bm.bmHeight;
DeleteObject(hBM);
return TRUE;
}
/*****************************************************************************
WEP:
Library exit routine.
******************************************************************************/
CALLBACK _export WEP(int nParameter)
{
if (nParameter==WEP_SYSTEM_EXIT || nParameter==WEP_FREE_DLL) return 1;
return TRUE;
}
/******************************************************************************
OurPrintf:
This routine formats and display a given set of arguments. The format
is given by the first argument. The argument 2 to n contain the
arguments for the specified format. The function uses MessageBox to
display the formatted string.
******************************************************************************/
OurPrintf(LPSTR fmt,...)
{
LPSTR ArgStart;
char string[256];
ArgStart=(LPSTR) &fmt; // pointer to first argument
ArgStart=&ArgStart[4]; // go past the first argument
wvsprintf(string,fmt,ArgStart);
if (FindWindow("DBWin",NULL)) { // debug window open
lstrcat(string,"\n");
OutputDebugString(string); // send to the debug terminal
}
else MessageBox(NULL,string,NULL,MB_OK);
return TRUE;
}
/******************************************************************************
Copy a specified number of bytes from the source to the destination location.
Both the source and destination locations are specified by using far pointers.
When source and destination memory overlaps, use FarMoveOl function for
a proper trasfer.
Small/Medium Model Note: This function will not work if compiled
as an EXECUTABLE under small/medium model using the Borland compiler.
This is because Borland 'C' does not have a fmemmove library function.
*******************************************************************************/
void FarMove(void far * src,void far * dest, WORD count)
{
WORD i,SrcOff,DestOff,SrcSeg,DestSeg;
char huge *SrcPtr,huge *DestPtr;
if (count==0) return; // nothing to move
SrcSeg=HIWORD((DWORD)(src)); // source segment
DestSeg=HIWORD((DWORD)(dest)); // destination segment
SrcOff=LOWORD((DWORD)(src)); // source offset
DestOff=LOWORD((DWORD)(dest)); // destination offset
// use _fmemmove function if source and destination do not wrap
if ((SrcOff+count)>SrcOff && (DestOff+count)>DestOff) _fmemmove(dest,src,count);
else { // move one by one if source of destination wrap
SrcPtr=(char huge *)src;
DestPtr=(char huge *)dest;
if ( (GetSelectorBase(SrcSeg)+SrcOff)
> (GetSelectorBase(DestSeg)+DestOff) ){ // source at higher address
for (i=0;i<count;i++) DestPtr[i]=SrcPtr[i];
}
else { // src at lower address, move in reverse order
for (i=count-1;i!=0xFFFF;i--) DestPtr[i]=SrcPtr[i];
}
}
return;
}
/******************************************************************************
FarMemSet:
This function every byte of the given far buffer to the specified character.
******************************************************************************/
void FarMemSet(void far *ptr,char chr, WORD count)
{
WORD i;
LPSTR lptr;
lptr=(LPSTR)ptr;
for (i=0;i<count;i++) lptr[i]=chr;
}