PDA

Click to See Complete Forum and Search --> : BGI Problems!


CyberCarsten
Aug 11th, 2000, 01:22 PM
I am beginner at C++, and I have a few problems with the BGI!
I have tried the following code:


#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
/* request autodetection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy, i;

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

/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) { /* an error occurred */
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}

midx = getmaxx() / 2;
midy = getmaxy() / 2;

/* loop through the fill patterns */
for (i=EMPTY_FILL; i<USER_FILL; i++) {
/* set the fill style */
setfillstyle(i, getmaxcolor());

/* draw the 3-d bar */
bar3d(midx-50, midy-50, midx+50, midy+50, 10, 1);
getch();
}
/* clean up */
closegraph();
return 0;
}


But I get the following error:
Graphics error: Device driver file not found (EVAVGA.BGI)
Press any key to halt:

But I have checked my C:\bc45\bgi\ dir, and I found the EVAVGA.BGI file there!!!???
Whats wrong!!!???




[Edited by CyberCarsten on 08-11-2000 at 02:24 PM]

parksie
Aug 11th, 2000, 05:57 PM
Is the BGI dir in your %PATH%?

CyberCarsten
Aug 12th, 2000, 05:02 AM
What do your mean by %PATH% ??

parksie
Aug 12th, 2000, 06:58 AM
It's an environment variable. Open up a console window, and type "set" (without the quotes). A list of environment variables will be displayed, and there should be a PATH entry there. %PATH% is the syntax for referencing the contents.

CyberCarsten
Aug 12th, 2000, 07:47 AM
I dont know what this means....I'm new to C++

parksie
Aug 12th, 2000, 07:51 AM
This isn't C++, it's basic DOS stuff. Did you never use DOS?

CyberCarsten
Aug 12th, 2000, 07:57 AM
Of course I did : o ))))

parksie
Aug 12th, 2000, 08:01 AM
Naturally. Anyway, quick fix time. Open up a console window, and navigate to the folder with your app in. Then type:

SET PATH=%PATH%;C:\BC45\BGI

Then run your program.

CyberCarsten
Aug 12th, 2000, 09:01 AM
Thank you!! I'll try that!!

CyberCarsten
Aug 12th, 2000, 09:03 AM
It still doesn't work....

parksie
Aug 12th, 2000, 09:07 AM
Hmmmmmmmmm. Do any drivers need to be loaded at startup for it to work?

CyberCarsten
Aug 12th, 2000, 09:14 AM
I dont't know....it was a sample program, I found in the help file...

parksie
Aug 12th, 2000, 09:18 AM
Oh yeah, it's the dodgy Borland sample apps. Few of the ones I tried actually worked :(. Try copying the driver files to your c:\windows\command folder.

CyberCarsten
Aug 12th, 2000, 09:24 AM
I'm running Win 2000 Pro, and I tried to copy the files in \BC45\BGI to the C:\winnt\system32 dir, but it didn't work...

parksie
Aug 12th, 2000, 03:02 PM
Win2000...this changes everything. Win2000 is based on NT and as such blocks off direct hardware access, so I doubt that your program will be able to do anything. Most graphics under Win2K has to be done through DirectX or another Microsoft-certified method.

CyberCarsten
Aug 12th, 2000, 03:44 PM
Ok, thanks any way! :o )