> InitGraph (procedure) (Graph unit)


 InitGraph (procedure)     (Graph unit)

Initializes the graphics system and puts the hardware into graphics mode.


 procedure InitGraph(var GraphDriver:Integer; var GraphMode: Integer;
    PathToDriver: string);


Real, Protected


If GraphDriver is equal to Detect, a call is made to any user-defined autodetect routines and then DetectGraph. If graphics hardware is detected, the appropriate graphics driver is initialized, and a graphics mode is selected.

If GraphDriver is not equal to 0, the value of GraphDriver is assumed to be a driver number. That driver is then selected, and the system is put into the mode specified by GraphMode procedure If you override autodetection in this manner, you must supply a valid GraphMode parameter for the driver requested.

PathToDriver specifies the directory path where the graphics drivers can be found. If PathToDriver is null, the driver files must be in the current directory.

Normally, InitGraph loads a graphics driver by allocating memory for the driver (through GraphGetMem), then loads the appropriate .BGI file from disk. As an alternative to this dynamic loading scheme, you can link a graphics driver file (or several of them) directly into your executable program file.

Do this by first converting the .BGI file to an .OBJ file (using the BINOBJ utility), then place calls to RegisterBGIdriver in your source code (before the call to InitGraph) to register the graphics driver(s). When you build your program, you must link the .OBJ files for the registered drivers. You can also load a BGI driver onto the heap and then register it using RegisterBGIdriver.

If memory for the graphics driver is allocated on the heap using GraphGetMem, that memory is released when a call is made to CloseGraph.

After calling InitGraph, GraphDriver is set to the current graphics driver, and GraphMode is set to the current graphics mode.

If an error occurs, both GraphDriver and GraphResult (a function) return one of the following grXXXX constant values: grNotDetected, grFileNotFound, grInvalidDriver, grNoLoadMem, or grInvalidMode.

See Also

Sample Code

 К началу страницы 
Тэги: InitGraph

Код для вставки: :: :: :: ГОСТ ::
Поделиться: //

Хостинг предоставлен компанией "Веб Сервис Центр" при поддержке компании "ДокЛаб"