SAMPLE: Drvsrv.dll Installs a Windows Printer Driver from a Print Server (297888)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), when used with:
    • the operating system: Microsoft Windows 95
    • the operating system: Microsoft Windows 98
    • the operating system: Microsoft Windows 98 Second Edition
    • the operating system: Microsoft Windows Millennium Edition

This article was previously published under Q297888

SUMMARY

The Prndrvsrv.exe sample archive contains a Microsoft Visual C++ project for a dynamic-link library (DLL) that can install printer driver files from a Microsoft Windows NT or Microsoft Windows 2000 print server.

Print servers that are based on Windows NT technology can serve printer driver installations to Windows 95, Windows 98, Windows 98 Second Edition (SE), and Windows Millennium Edition (Me) clients. This sample contains Visual C++ code that demonstrates the API usage that is necessary to identify, download, and install the printer driver files on the client computer. In the form of a DLL, this code can be called from other programs, including batch or scripting processes, by using Rundll32.exe.

The techniques that are used in this DLL can be used to programmatically install Point and Print printers on Windows 95 and its successor versions.

The DLL is provided as only a demonstration of installing driver files. Executable files that are released to production should be robustly developed and tested.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:
Release Date: Jun-05-2001

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. The Prndrvsrv.exe file contains a complete Visual C or Visual C++ 6.0 DLL project. A prebuilt DLL is provided as a convenience to developers who are using a language other than Visual C or Visual C++.

For additional information on the technique used by this sample, click the article number below to view the article in the Microsoft Knowledge Base:

203604 HOWTO: Install Printer Drivers from a Network Print Server

For an example of the Microsoft Visual Basic Declare statement that is required to use this DLL from Visual Basic, see the comments in the InstallDriver function in the Drvsrv.cpp source file.

For an example of how to use this DLL with Rundll32.exe, see the comments for the Install function in the Drvsrv.cpp source file.

To use this sample, extract the contents of the Prndrvsrv.exe file into an empty folder. After the files are extracted, the DLL project can be rebuilt using Visual C or Visual C++ by opening the Drvsrv.dsw project workspace.

The prebuilt DLL file may be used in Visual Basic by declaring and calling the InstallDriver function in Visual Basic.

Modification Type:MinorLast Reviewed:4/4/2006
Keywords:kbdownload kbDSWGDI2003Swept kbfile kbGDI kbprint kbSample kbSpooler KB297888 kbAudDeveloper