How To Programmatically Install a Display Driver (232539)



The information in this article applies to:

  • Microsoft Windows NT Server 4.0
  • Microsoft Windows NT Workstation 4.0

This article was previously published under Q232539

SUMMARY

This article explains how to programmatically install a Windows NT 4.0 Display Driver after installation of the operating system has been completed.

MORE INFORMATION

To install a new Display Driver, the Display control panel applet Desk.cpl exports the function InstallGraphicsDriver().

This function is defined as:

DWORD
InstallGraphicsDriver(
   HWND    hwnd, /* Optional */ 
   LPCWSTR pszSourceDirectory,
   LPCWSTR pszModel,
   LPCWSTR pszInf
   )
				

Parameters



hwnd
				

Handle to the Parent Window (Optional).

pszSourceDirectory
				

NULL-terminated Unicode string that contains the Directory where the display driver can be found.

pszModel
				

NULL-terminated Unicode string that contains the device description found in the associated .inf file.

pszInf
				

NULL-terminated Unicode string that contains the .inf file for the Display Driver.

A program written to use this function might look like the following sample:

Graphics.c
#include <windows.h>

int wmain( int argc, wchar_t *argv[ ], wchar_t *envp[ ] )
{
    HINSTANCE hLib;
    if (hLib = LoadLibrary("desk.cpl"))
    {
       FARPROC InstGraphDrv;
       if (InstGraphDrv = GetProcAddress(hLib,"InstallGraphicsDriver"))
           (InstGraphDrv)(NULL,argv[1],argv[2],argv[3]);

       FreeLibrary(hLib);
    }
}
				
To install the 3D RAGE PRO TURBO driver using a driver and an *.inf file in the directory C:\ati\, the command might look like the following:
Graphics.exe c:\ati\ "3D RAGE PRO TURBO" ati.inf
				

Modification Type:MinorLast Reviewed:8/30/2004
Keywords:kbdisplay kbhowto kbsetup KB232539