Home All Groups Group Topic Archive Search About

Using VBPRNDLG.DLLl Instead of Print Common Dialog Boxes

Author
5 Mar 2009 6:59 PM
Rick Raisley
I've read some comments here where people don't like to use the VB standard
Common Dialog Box control for printing, etc. In the process of setting paper
size, a search I did came up with the following link:

http://support.microsoft.com/kb/322710

Here, Microsoft recommends using a free, downloadable control Vbprndlg.dll
instead, stating that it exposes far more properties to the user/programmer,
and gives steps on how to use it.

Has anyone used this control? Is it preferable? What are the advantages to
you?

--
Regards,

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

Author
5 Mar 2009 7:50 PM
Ralph
Show quote Hide quote
"Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message
news:%235Ff4RcnJHA.864@TK2MSFTNGP04.phx.gbl...
> I've read some comments here where people don't like to use the VB
standard
> Common Dialog Box control for printing, etc. In the process of setting
paper
> size, a search I did came up with the following link:
>
> http://support.microsoft.com/kb/322710
>
> Here, Microsoft recommends using a free, downloadable control Vbprndlg.dll
> instead, stating that it exposes far more properties to the
user/programmer,
> and gives steps on how to use it.
>
> Has anyone used this control? Is it preferable? What are the advantages to
> you?
>

It has been my experience that ANYTHING that works is preferable to the
inherent Print Common Dialog. Best you forget it even exists.

The advantages are less aggravation and a longer life span.

-ralph
Author
5 Mar 2009 8:21 PM
Saga
And it will be even more preferable if it does not set the Windows default
printer to the one selected by the user within the VB app. Saga
--



Show quoteHide quote
"Ralph" <nt_consulting64NON@SPAMMEyahoo.com> wrote in message
news:uLwrYzcnJHA.4964@TK2MSFTNGP05.phx.gbl...
>
> "Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message
> news:%235Ff4RcnJHA.864@TK2MSFTNGP04.phx.gbl...
>> I've read some comments here where people don't like to use the VB
> standard
>> Common Dialog Box control for printing, etc. In the process of setting
> paper
>> size, a search I did came up with the following link:
>>
>> http://support.microsoft.com/kb/322710
>>
>> Here, Microsoft recommends using a free, downloadable control Vbprndlg.dll
>> instead, stating that it exposes far more properties to the
> user/programmer,
>> and gives steps on how to use it.
>>
>> Has anyone used this control? Is it preferable? What are the advantages to
>> you?
>>
>
> It has been my experience that ANYTHING that works is preferable to the
> inherent Print Common Dialog. Best you forget it even exists.
>
> The advantages are less aggravation and a longer life span.
>
> -ralph
>
>
Author
5 Mar 2009 8:31 PM
Rick Raisley
I always set the default settings back the way they were, immediately after
printing, if I change any. The question here is how to change settings. Is
the VBPRNDLG.DLL any good, and preferable to other methods.

--
Regards,

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

Show quoteHide quote
"Saga" <antiSpam@somewhere.com> wrote in message
news:%23ktDI$cnJHA.1248@TK2MSFTNGP03.phx.gbl...
> And it will be even more preferable if it does not set the Windows default
> printer to the one selected by the user within the VB app. Saga
> --
>
>
>
> "Ralph" <nt_consulting64NON@SPAMMEyahoo.com> wrote in message
> news:uLwrYzcnJHA.4964@TK2MSFTNGP05.phx.gbl...
>>
>> "Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message
>> news:%235Ff4RcnJHA.864@TK2MSFTNGP04.phx.gbl...
>>> I've read some comments here where people don't like to use the VB
>> standard
>>> Common Dialog Box control for printing, etc. In the process of setting
>> paper
>>> size, a search I did came up with the following link:
>>>
>>> http://support.microsoft.com/kb/322710
>>>
>>> Here, Microsoft recommends using a free, downloadable control
>>> Vbprndlg.dll
>>> instead, stating that it exposes far more properties to the
>> user/programmer,
>>> and gives steps on how to use it.
>>>
>>> Has anyone used this control? Is it preferable? What are the advantages
>>> to
>>> you?
>>>
>>
>> It has been my experience that ANYTHING that works is preferable to the
>> inherent Print Common Dialog. Best you forget it even exists.
>>
>> The advantages are less aggravation and a longer life span.
>>
>> -ralph
>>
>>
>
>
Author
5 Mar 2009 8:42 PM
Ralph
"Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message
news:uWeiRFdnJHA.1168@TK2MSFTNGP05.phx.gbl...
> I always set the default settings back the way they were, immediately
after
> printing, if I change any. The question here is how to change settings. Is
> the VBPRNDLG.DLL any good, and preferable to other methods.
>

That IS a different question.

The VBPrnDlg has some reported issues.

Perhaps the most reliable method (and provides the most flexibility for
special situations) for VB is to use the WinAPI directly. There are tons of
examples on the web.

-ralph
Author
5 Mar 2009 10:48 PM
Mike Williams
"Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message
news:uWeiRFdnJHA.1168@TK2MSFTNGP05.phx.gbl...

> 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
Author
6 Mar 2009 1:48 PM
Rick Raisley
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

Show quoteHide quote
"Mike Williams" <M***@WhiskyAndCoke.com> wrote in message
news:Ow2OlRenJHA.4964@TK2MSFTNGP05.phx.gbl...
> "Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message
> news:uWeiRFdnJHA.1168@TK2MSFTNGP05.phx.gbl...
>
>> 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
>
>
>
Author
6 Mar 2009 9:40 PM
Bee
try planet source code for some examples
http://www.planetsourcecode.com/vb/default.asp?lngWId=1

Show quoteHide quote
"Rick Raisley" wrote:

> I've read some comments here where people don't like to use the VB standard
> Common Dialog Box control for printing, etc. In the process of setting paper
> size, a search I did came up with the following link:
>
> http://support.microsoft.com/kb/322710
>
> Here, Microsoft recommends using a free, downloadable control Vbprndlg.dll
> instead, stating that it exposes far more properties to the user/programmer,
> and gives steps on how to use it.
>
> Has anyone used this control? Is it preferable? What are the advantages to
> you?
>
> --
> Regards,
>
> Rick Raisley
> heavymetal-A-T-bellsouth-D-O-T-net
>
>
>