Solved

Default Printer Name from Registry

Posted on 2001-06-14
4
443 Views
Last Modified: 2013-11-20
Hi,

Is there a way to get Default Printer Name , Port Number and the Driver Name and their PATH from the Registry? And is it possible through Microsoft Java?

Please Help.

Thanks a lot,
VK

0
Comment
Question by:vku
4 Comments
 

Accepted Solution

by:
sgupta00 earned 100 total points
ID: 6193212
Here as some useful links .......

http://support.microsoft.com/support/kb/articles/Q156/2/12.asp

http://support.microsoft.com/support/kb/articles/q271/2/57.ASP

also look at this key in the registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers

0
 
LVL 2

Expert Comment

by:Chandra V
ID: 6194722
If you are in Windows 95 or 98 the information is found in

"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Print\\Printers\\"

Driver - "Printer Driver"
Port   - "Port"

Otherwise you can get the printer name using API

DEVMODE FAR *pDevMode=(DEVMODE FAR *)::GlobalLock(m_hDevMode);

and accessing 'pDevMode->dmDeviceName'
0
 
LVL 1

Expert Comment

by:Tim_Musschoot
ID: 6364064
Use the CPrintDialog class:

example:

CPrintDialog dlg(FALSE);

if (!dlg.GetDefaults())
   AfxMessageBox(_T("You have no default printer!"));
else
{
   CString strDescription;

   strDescription.Format(_T("Your default printer is %s on %s using %s."),
      (LPCTSTR) dlg.GetDeviceName(),
      (LPCTSTR) dlg.GetPortName(),
      (LPCTSTR) dlg.GetDriverName());

   AfxMessageBox(strDescription);
}

Tim Musschoot
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9484706
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by : sgupta00

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
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

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

27 Experts available now in Live!

Get 1:1 Help Now