I'm looking for some sample code (VBA97 or VB6) for reading the model (driver?) name of a printer (the default printer would be fine).
The ActivePrinter property gives me <printer path> on <port>, but what I am after is the model name that the driver provides (as in the 'General' tab of the printer properties).
It seems possible in VBA XP (I think the driverName property can be used), but I'm stuck for VBA 97/VB6...
I've thought of using the HKLM\System\CurrentControlSet\Print\Printers\Default registry settings, but this doesn't appear to get updated when I set a default printer (in WinXP, anyway).
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Server Name, Printer Name and Driver name are all part of the PRINTER_INFO_2 structure that you can get using the API call GetPrinter as per this article
The printer.devicename gives you the same as ActivePrinter does in VBA. I guess this is OK for locally-attached printers but for network ones it gives you somethine like
\\server\printer on NE01:
What I was after was the actual model of the printer, something like:
HP LaserJet 5M
(I have my reasons!)
Anyway, I think I've found a solution - and it was to use the registry keys for the printers, found within CurrentControlSet.
The attached Word (97) file should explain all this. It is an amalgam of a lot of different idea that I have tried, so it is very poorly commented, and there may be a lot of redundant code!!! A lot of it has come from other sample code - for example MSDN article Q143274 and Jonathan West's series on controlling printers within VB. Thank you for your help!!!
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
I want to know the model name of the printer not the driver name installed on it. The sample shared is giving the name of the driver not the model name. Is there any way to get the printer model name?
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.