The first four modules provide the source code for a Printer Select dialog form, in an ActiveX DLL class format. The last three modules provide a simple test platform to engage the Printer Select class.
For those who are interested in using the code, please download each block code and save according to the instructions. The various files should be saved in one directory.
Hopefully, for those who need to get around Microsoft's useless Common Dialog Box's ShowPrinter "features", this module provides the starting point for adding a Printer Select dialog form to your projects. With the complete source code available below, one can extract a lot more information than the ShowPrinter provides and can build in features that you deem desirable. (The software below does not alter Windows' default printer setting to the selected printer.)
The Test1.frm code shows how to interface to this class. It is rather simple: 1. Make a project reference to the class. 2. Declare a variable of the class type: Private m_PrintSelect As clsPrintSelect 3. Instantiate a member of the class type: Set m_PrintSelect = New clsPrintSelect 4. Call the PrinterSelect routine. m_PrintSelect.PrinterSelect 5. After selecting the printer and clicking on Okay, the program should call the class to get a pointer to the printer: Set ptrMyPrinter = m_PrintSelect.PrinterSelected
Additional features may be added as you wish, albeit that that is your responsibility.
Module 1: PrintSelect.vbp -- project file for the Printer Select class. Module 2: printsel.frm -- the Printer Select dialog form. Module 3: mdlPrinterAccess.bas -- the printer access routines. Module 4: clsPrintSelect.cls -- the class interface. Module 5: Test1.frm -- a simple form with one command button to call the Printer Select class. Module 6: Test1.vbp -- project file for the test platform. Module 7: PrintSelect.vbg -- the group file for the test platform.
The modules have been divided into seven parts to fit within Tek-Tips' constraints. Part 1 contains PrintSelect.vbg, PrintSelect.vbp, Test1.vbp and Test1.frm. Parts 2A (FAQ222-3604), 2B, (FAQ222-3614) and 2C (FAQ222-4285) contains the mdlPrinterAccess.bas.<BR> Parts 3A (FAQ222-3605) and 3B (FAQ222-4286) contains PrintSel.frm. Part 4 (FAQ222-4287) contains clsPrintSelect.cls.
My company, Professional Logics Corporation (PLC), has agreed to the release of this programming with the following conditions: 1. Copyright notices must remain in the source code. PLC reserves all rights to the use of this code, except as listed here.
2. The code may be used, as is or as modified by the user, for non-profit and commercial use, without the obligation of royalties.
3. Writing credit must be given to PLC if the code is used in a commercial product. Such credit to be comprised of mention of PLC's supply of the Printer Select dialog form source code. Such credit should be included in the About menu item and/or the help file.
4. PLC shall not indemnify anyone or any company that uses the code.
5. PLC does not warranty or guarantee the correctness of the code.
6. PLC does not provide any support for the source code provided or to any product that uses the source code.