Re: Using VBPRNDLG.DLLl Instead of Print Common Dialog Boxes

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks very much for that thorough analysis, Mike. I will definitely be
looking into doing it that way.

--
Regards,

Rick Raisley
heavymetal-A-T-bellsouth-D-O-T-net

"Mike Williams" <Mike@xxxxxxxxxxxxxxxxx> wrote in message
news:Ow2OlRenJHA.4964@xxxxxxxxxxxxxxxxxxxxxxx
"Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message
news:uWeiRFdnJHA.1168@xxxxxxxxxxxxxxxxxxxxxxx

I always set the default settings back the way they were,
immediately after printing, if I change any.

But it may be too late by then. The best option is not to change the
default settings at all.

The question here is how to change settings. Is the VBPRNDLG.DLL
any good, and preferable to other methods.

The VBprndlg.dll is a wrapper around the API print dialog functions and it
works reasonably well, although like most things it is not perfect. It is
far easier than using the API dialogues for a similar purpose though,
partly because of the messing about you need to do to properly get at the
various memory blocks. The problem with it (and the same problem exists
even when you use the API dialogs directly) is that no matter how much
trouble you go to in order to obtain as many settings as possible you
cannot actually use any user setting from the dialog that the VB Printer
Object cannot "eat", so there are some limitations. However, those same
limitations apply even if you instead use the API printer dialog functions
to perform a similar task.

The vbprndlg.dll is certainly quite useful, and it will not alter the
existing default printer settings, so it is definitely worth using. It is
certainly very much better than the standard CommonDialog Control.
Alternatively, you could "roll your own" dialog using a VB modal Form if
you just want to present a very simple, albeit non standard, dialog to the
user with only a limited number of available settings (using a ListBox and
various option buttons). The main problem with the vbprndlg method and the
alternative API method (a problem which does not apply to the simple "roll
your own" dialog I mentioned, although that of course has its own more
serious limitations), is the fact that they present a printer dialog to
the user and give the user the impression that anything he selects in the
entire dialog will be reflected in his printout, which is simply not the
case. It works for most of the standard settings, but there are various
settings, some of which are special to certain printers, which simply
cannot be "eaten" by the VB Printer Object, and some of which cannot even
be obtained from the dialog itself, at least not in any meaningful way,
whether the VB Printer Object could "eat them" or not.

The only way I personally know of presenting your user with a standard
print dialog in such a way that the printer will respond to all of the
settings the user might make in the dialog, including all of the otherwise
impossible to get at things and all of the "special to printer" things, is
to present the user with a printer dialog using a standard CommonDialog
Control (PrinterDefault set to False and the returnDC flag set) or the
vbrndlg.dll or the API dialog functions themselves and print your stuff to
the returned DC. The only problem with this method of course is that you
would then need to do all your printing using the API drawing and printing
methods instead of the more friendly VB Printer Object methods, which
would mean quite a lot of change to any existing printer code you may have
written and would of course have a bit of a learning curve if you have not
used the API printing and drawing functions before.

If you would prefer to continue to use the VB Printer Object for your
printing then personally I would advise you to stay away from the
CommonDialog Control and to use either the vbprndlg.dll or the alternative
API dialog methods, choosing the vbprndlg.dll for its relative simplicity
if you are happy to package an extra DLL with your project when you deploy
it to other machines and instead choosing the API dialog methods if you
are not prepareed to do that.

Mike





.



Relevant Pages

  • Re: Using VBPRNDLG.DLLl Instead of Print Common Dialog Boxes
    ... It is far easier than using the API dialogues for a similar purpose though, partly because of the messing about you need to do to properly get at the various memory blocks. ... The problem with it is that no matter how much trouble you go to in order to obtain as many settings as possible you cannot actually use any user setting from the dialog that the VB Printer Object cannot "eat", ... The only way I personally know of presenting your user with a standard print dialog in such a way that the printer will respond to all of the settings the user might make in the dialog, including all of the otherwise impossible to get at things and all of the "special to printer" things, is to present the user with a printer dialog using a standard CommonDialog Control or the vbrndlg.dll or the API dialog functions themselves and print your stuff to the returned DC. ... The only problem with this method of course is that you would then need to do all your printing using the API drawing and printing methods instead of the more friendly VB Printer Object methods, which would mean quite a lot of change to any existing printer code you may have written and would of course have a bit of a learning curve if you have not used the API printing and drawing functions before. ...
    (microsoft.public.vb.general.discussion)
  • Re: ACCURACY of making templates on a printer
    ... Yes, if you make sure the paper is always stacked and loaded perfectly then you can position and size printed output accurately on the page when printing from VB, but you cannot make a silk purse out of a sow's ear so you will never be able to guarantee positioning to a greater accuracy than the manufacturing tolerances of your printer allow. ... For example I've just been looking online at some HP printers and the acceptable positioning tolerance seems to be in the region of 0.03 inches with an "acceptable skew" of an additional 0.03 inches over the height of a 10 inch page. ... at different settings, even on the same printer depending on whether or not it is currently set to normal or borderless or "minimize margins" or whatever setting your specific printer provides. ...
    (microsoft.public.vb.general.discussion)
  • Re: Printing problems in outlook?
    ... >>on the printserver with different settings. ... >>easily choose their printing needs and the printserver ... >>Robert Sparnaaij ... involves Outlook and a Hp8150 printer. ...
    (microsoft.public.outlook.general)
  • Re: Default printer being changed with Common dialog
    ... When done printing, restore the default printer leaving the ... default settings of PrinterB will have been changed and those changes will ... one printer driver. ...
    (microsoft.public.vb.general.discussion)
  • Re: API PrntDlg function
    ... You're supposed to also follow the instructions to register the DLL using ... more or less the same job without requiring you to use any API functions. ... anything to the chosen printer you still need to use the VB Printer Object ... printing methods in the normal way. ...
    (microsoft.public.vb.general.discussion)