Category : C Source Code
Archive   : BCPPTECH.ZIP
Filename : TI707.ASC

 
Output of file : TI707.ASC contained in archive : BCPPTECH.ZIP







PRODUCT : Borland C++ NUMBER : 707
VERSION : 2.0
OS : DOS
DATE : February 25, 1992 PAGE : 1/2

TITLE : Linking Third Party BGI Drivers




/*************************************************************
This document explains how to link third party graphics drivers
into your program. This example is specific to the vga256.bgi
driver which is available on the Borland BBS (408) 439-9096. The
procedure is the same to link in one of the drivers that was
shipped with your product except that you don't need to make the
call to installuserdriver() function which means that you also
don't need the alwayszero() function.

1. Convert vga256.bgi to an object file with this command:

BGIOBJ vga256.bgi vga256.obj _vga256_driver

2. Create a project file for the program that links in the
driver. The project should contain two items:

A. test.c
B. vga256.obj

3. Here's what test.c would look like:

************************************************************/

#include
#include
#include
#include

/* function prototypes */
int huge alwayszero(void);
void checkerrors(void);
void _Cdecl vga256_driver(void);


int main(void)
{
int gdriver, gmode;

/* install the user defined driver into the system */
gdriver = installuserdriver("vga256", alwayszero);

/* check for any installation errors */
checkerrors();













PRODUCT : Borland C++ NUMBER : 707
VERSION : 2.0
OS : DOS
DATE : February 25, 1992 PAGE : 2/2

TITLE : Linking Third Party BGI Drivers




/* register the driver with the graphics system */
registerbgidriver(vga256_driver);

/* check for any installation errors */
checkerrors();

/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");

/* check for any initialization errors */
checkerrors();

/* draw a line */
setcolor(WHITE);
line(0, 0, getmaxx(), getmaxy());

/* clean up */
getch();
closegraph();
return 0;
}

int huge alwayszero(void)
{
return 0;
}

/* check for and report any graphics errors */
void checkerrors(void)
{
int errorcode;

/* read result of last graphics operation */
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
}









  3 Responses to “Category : C Source Code
Archive   : BCPPTECH.ZIP
Filename : TI707.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/