Solved

Default Printer Name from Registry

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C++ BOOL WINAPI ReadFile fails on windows 10 when reading from USB cable 9 431
How to determine file rename from EventLog ? 2 49
move a line in eclipse 3 102
mapBully challenge 6 134
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

772 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