Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer Select Dialog Form (ActiveX Source Code) 1

Status
Not open for further replies.

CassandraR

Programmer
Aug 10, 2001
346
CA

Hi:

I have posted the source code for a Printer Select ActiveX DLL in the FAQ area of the forum. It is located under "What Visual Basic should be able to do!"

The code has been split into three blocks:
"Printer Select Dialog Form (ActiveX Source Code)"
"Printer Select Dialog Form -- Part Two"
"Printer Select Dialog Form -- Test Code"

We know the limitations of the Microsoft Common Dialog ShowPrinter and we need to get around Microsoft's shortcomings. Hopefully, the code will get you started on burying those shortcomings.

Cassie
;-)
 
Teh links are,

faq222-3603
faq222-3604
faq222-3605

respectivly.

Cassie2002, I'll look at them in more detail later this week.

Thanks and Good Luck!

zemp
 
Parts of the faq have been truncated, all in all, it seems like it is a good faq.

Thanks,
James
[shadeshappy] [evil]
"Make it idiot-proof and someone will make a better idiot." ~bumper sticker
 


Hi James:

Thanks for pointing this out. I have looked at the FAQs that I posted and have split the second part into parts.

The FAQs are located in
FAQ222-3603 -- (ActiveX Source Code) - Modules 1 and 2
FAQ222-3604 -- Part Two - Start of Module 3
FAQ222-3614 -- Part Two B - End of Module 3 plus Module 4
FAQ222-3605 -- Test Code -- Optional modules 5, 6, and 7

Cassie

 
You get a start for this faq...One thing i have noticed tho is that on a lexmark T522, this method does not work (i tried with the devmode also before trying your method. I've been working on this for about 6 months now, still scraching my head as to why it doesn't work.) It does work on all other printers i have (pdf makers, fax drivers, hp laser, deskjet, and designjet printers. I can't figure out why it doesn't work on my lexmark. All other programs can change the settings. I think it has to do with the lexmark server programs...Asking lexmark why...Well let you know.

Thanks,
James
[shadeshappy] [evil]
"Make it idiot-proof and someone will make a better idiot." ~bumper sticker
 


Hi James:

Thanks for the star!!

As for the Lexmark problem, I cannot help you there as I do not have a Lexmark printer to check out the code. Have you checked to see whether there is a driver update for the printer?

Cassie
:)
 
Yeah, i have 7.4.1, trying 7.4.2, but don't think that will help, per their update paper, all they did was add some "fancy" things to the settings pages...will see.

Thanks,
James
[shadeshappy] [evil]
"Make it idiot-proof and someone will make a better idiot." ~bumper sticker
 
Which shortcomings are we talking about?
 
Hello...
 
The common dialog is very limited from what you can get out of it. (printer wise) microsoft does have a updated version out there, but even that is limited (you only get priner settings, which is semi helpful when you are trying to use the printer apis) With her faq i found all my answers on how to set printer settings through api. No where (that i found on the inet or this site) is documented on how you go about setting default printer setting through api. I knew of devmode, but she also talks about some ps printers that don't accept the devmode structure, so you need to use the printer2_info structure instead. The code i created matched very closely to what her company was doing (or herself). If you are like me and can't use the printer object, the only option is to temporarly change the default printer settings, then change them back (with out user intervention every time) is with api's. Just a thought.

Thanks,
James
[shadeshappy] [evil]
"Make it idiot-proof and someone will make a better idiot." ~bumper sticker
 


Hi StrongM:

I have, over time on various fora, seen many people complain about MS' CDL.ShowPrinter and its way of working. If you want to change Windows' default printer, then by all means use ShowPrinter. However, if you do not want your program to change Windows' default printer setting or if you want more information, then you will need to add code to do these things.

The DLL that we (my company and I) have supplied provides the basis for being able to choose a printer, query its statuses and to alter its default settings. With this code, those people who need more functionality or more friendliness than ShowPrinter bestows will be able to get their own Printer Select form up and running. (The supplied code is "complete" in that it has the more commonly desired features.

Beyond this, I will leave it up to other users to comment on the shortcomings.

Cassie
 
Still problems with the lexmark printer...The devmode method changes the default settings (so it seems through the control pannel) but when you go to any other app, (ie, word, excel, write, notepad) the changes aren't reflected. Got in touch with lexmark, they sent me some junk about the pcl commands, told them that it isn't working at all. If you change the properties of the document that will work, but i can't figure out how to change a docuemnt that is being printed from the internet explorer control...If any one knows i would sure like some help.

Thanks,
James
[shadeshappy] [evil]
"Make it idiot-proof and someone will make a better idiot." ~bumper sticker
 
>However, if you do not want your program to change >Windows' default printer setting...

...then just set the CDL's PrinterDefault property to False
 
The point is that the major failing of the Printer Dialog, as exposed by the CDC, is that hack that MS use to change the printer that VB uses; i.e to change the default printer.

But this can be pretty easily avoided by directly calling the underlying dialog, rather than using the CDC which wraps it, and which also avoids reinventing the wheel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top