• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 456
  • Last Modified:

Default Printer Name from Registry

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
vku
Asked:
vku
1 Solution
 
sgupta00Commented:
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
 
Chandra VConsultantCommented:
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
 
Tim_MusschootCommented:
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
 
Roshan DavisCommented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now