Link to home
Start Free TrialLog in
Avatar of markrhyman
markrhyman

asked on

Print Quality in VB6

Hello,

I am trying to set the print quality to the maximum before sending a print job in VB:

objPrinter.PrintQuality = vbPRPQHigh

However, I get the message:

'PrintQuality' Property is read only.

In the Default printer setting the print quality is set to 1200 which is the maximum. But when I check the printquality value in the code above this value is only to 600. That's what I want to code this value to it's maximum.

Any idea?

thanks
Avatar of RanjeetRain
RanjeetRain

Can you please post the entire relevent code?
The method you are using is correct. But if you are facing some problem, you can use Windows API. This page (http://support.microsoft.com/kb/q190218/) lists the code necessary to get printer driver's settings. You can use the same code with some modifications to set the settings. Take a look at the Type DEVMODE. You have to set the dmPrintQuality to DMRES_HIGH = (-4).

Let me know if you need help with the code.
Avatar of markrhyman

ASKER

Below is some of the code I use to try to set the print quality.

Dim objPrinter As Printer

Set objPrinter = GetDefaultPrinter()

objPrinter.PrintQuality = vbPRPQHigh
Possibly you/the user under whose login your program runs, do not have permission to change printer settings. Have you checked that? If no luck, you can try Windows API method.
I am the administrator on my computer and the domain administrator.  I have checked permissions and I do have all of them when I try to change the print quality.  

I will give a try to the API method that you've linked me to.  
Allright I had a look at the code.

How do you set that devmode printquality...


I did:

Dim pDevMode As DEVMODE

pDevMode.dmPrintQuality = DMRES_HIGH

MsgBox pDevMode.dmPrintQuality

and the msgbox says -4 which is -4

When I run the code from microsoft it still says in the listbox Printquality = 600 dpi

Merely changing the property is not sufficient. You have to pass a DEVMODE structure to SetPrinter Windows API call. See this page (http://support.microsoft.com/kb/140285/EN-US/) for detailed info on the same.
This code is in C++ I think :) I have to look for something similar in VB.
RanjeetRain,

Did you find anything in VB?  I cannot integrate the code you pointed to me.  

Thanks
Maybe the question should not be deleted. This section might be good for someone willing to put some time to convert the code that RanjeetRain pointed to (C++ to VB) or it might be useful for some C++ user.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of ee_ai_construct
ee_ai_construct
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial