Solved

Printing Using the Common Dialog

Posted on 2002-04-23
11
191 Views
Last Modified: 2010-05-02
I want an example on how to use the Prining feature of the "Microsoft Common Dialog".
To be more specific, I want to get the value of the "selected printer" witch is returned by the "CommonDialog1.Hwd" property.
I want to use the "selected printer" in order to print a document in the "Acrobat Reader Control".
My Question is: How do I make the connection between the "Microsoft Common Dialog" and the "Acrobat Reader Control".
0
Comment
Question by:avissar
11 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 6962210
You could skip the common dialog and use the ADOBE activex Control's printWithDialog method directly:

    Pdf1.SRC = "c:\ardent\uvodbc\uvodbc.pdf"
    Pdf1.printWithDialog

For example.
0
 
LVL 12

Expert Comment

by:roverm
ID: 6990011
You can get the default printer by reading the registry.
For W2K Pro it's this key:

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows

String: Device

This will give you all printers available:

Sub Test()
Dim prt As Printer

    For Each prt In Printers
        List1.AddItem prt.DeviceName
    Next prt

End Sub

D'Mzzl!
RoverM
0
 

Author Comment

by:avissar
ID: 6990261
This doesn't answer my question, because in my application the user needs to choose a printer at start, and then the application prints the document automaticly.
Registry is not an option, because I open the common Dialog from the web.
0
 
LVL 12

Expert Comment

by:roverm
ID: 6991886
Is your application in VB or ASP/HTML ?
0
 

Author Comment

by:avissar
ID: 6993233
Its an ASP/HTML application
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 12

Expert Comment

by:roverm
ID: 7004738
Then this can be very difficult...
Can you run any ActiveX components on the clients machines ?
0
 

Author Comment

by:avissar
ID: 7005410
Yes I can!
The problem I have exist also in VB.
After the user chooses a printer using the CommonDialog, I need to "tell" the Acrobat Reader to print with the selected printer.
0
 
LVL 12

Expert Comment

by:roverm
ID: 7005510
If you can run an ActiveX control you CAN change the registry and set the default printer temporary to the selected printer.
Is this still no option then ?
0
 

Author Comment

by:avissar
ID: 7006158
But I stil dont know what printer did the user choose.
How can I get that information from the CommonDialog control?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7660699
Hi avissar,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

avissar, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 7755378
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now