| Home
| Previous
| Next
| Up

### Locating and Calling Device Driver Functions

Once you have a pointer to the device driver context structure, you then need to locate the pointers to the device driver functions of interest. Once a graphics device driver is loaded, the GA_queryFunctions function is the single entry point where you can query the driver to determine what functions it supports and to obtain pointers to those functions. All of the functions in the device driver are grouped together into functional groups, and you can obtain pointers to each individual group of functions by calling GA_queryFunctions with the identifier of the group you are interested in. If the driver does not support a particular group of functions, it may return FALSE, indicating the hardware device does not support that entire function group. Within a particular group of functions, certain entry points may be set to NULL if the driver or hardware does not support that particular feature within the group.

For example in order to call the GetVideoModeInfo function to enumerate the available display modes, you need to fill in the structure of pointers to the main init functions. To do this, use the following code (make sure you fill in the dwSize member with the size of the structure you are passing in!):

GA_initFuncs initFuncs;
bool LoadInitFuncs(GA_devCtx *dc)
{
initFuncs.dwSize = sizeof(initFuncs);
if (!GA_queryFunctions(dc,GA_GET_INITFUNCS,&initFuncs))
return false;
return true;
}

Once you have the list of function pointer for the function group you are interested in, you can simply call the returned functions via the function pointers contained within the structure. Make sure you first check that the function pointer is not NULL, since it is valid for optional functions to be returned as NULL by the loaded drivers.

Note: You must obtain a copy of all function groups (except the GA_initFuncs group) every time that you change display modes, as the features and capabilities of the driver and/or hardware device may change between different screen resolutions and color depths.

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com