🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: microsoft.public.vb.general.discussion
2 messages
2 total messages Started by AS Thu, 12 Nov 2026 15:39
VB printer trick
#2
Author: AS
Date: Thu, 12 Nov 2026 15:39
25 lines
1498 bytes
very old trick but may be useful for those still using VB

the printer object exposes a number of properties of the currently
selected printer, but it only reflects the values retrieved at start
and not the current ones; willing to update those values

issue a Printer.Print ""; then read the proprties you're interested in
and issue a KillDoc to cancel the print job and avoid any issue; the
same trick also works with any printer in the printers collection, so
if you do something like


For Each objPrt in Printers
  objPrt.Print "";
  ' here we retrieve the 
  ' desired properties...
  objPrt.KillDoc
Next


it will work for any configured printer


Re: VB printer trick
#3
Author: AS
Date: Thu, 12 Nov 2026 16:05
21 lines
1478 bytes
> For Each objPrt in Printers
>   objPrt.Print "";
>   ' here we retrieve the 
>   ' desired properties...
>   objPrt.KillDoc
> Next

example

https://itstillworks.com/how-to-get-printer-information-using-vb6.html

let's say you use the code presented at the above URL, now let's say
you change the paper from A4 to Letter or whatever else and use the
printer menu to reconfigure the current paper format; your VB app will
still report A4, but not if you use the trick we saw :) all in all it's
perfectly logical; why polling all printers all time if we don't need
them :)

 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads