Solved

Default Printer Name from Registry

Posted on 2001-06-14
4
442 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

13 Experts available now in Live!

Get 1:1 Help Now