Microsoft KB Archive/297888

{|
 * width="100%"|

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

 * }

Q297888

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), 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

-

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:

"Prndrvsrv.exe" Release Date: Jun-05-2001

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

"Q119591 How to Obtain Microsoft Support Files from Online Services" Microsoft used the most current virus detection software available on the date of posting to scan this file for viruses. Once posted, the file is housed on secure servers that 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:

"Q203604 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.

Additional query words: point-n-print addprinter addprinterdriver driver_info_3 printer_info_2 connect printer driver spool prndrvsrv

Keywords : kbfile kbsample kbGDI kbPrinting kbSDKWin32 kbSpooler kbDSupport kbGrpDSGDI

Issue type :

Technology : kbAudDeveloper kbWin32API