vku
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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(strDescripti on);
}
Tim Musschoot
example:
CPrintDialog dlg(FALSE);
if (!dlg.GetDefaults())
AfxMessageBox(_T("You have no default printer!"));
else
{
CString strDescription;
strDescription.Format(_T("
(LPCTSTR) dlg.GetDeviceName(),
(LPCTSTR) dlg.GetPortName(),
(LPCTSTR) dlg.GetDriverName());
AfxMessageBox(strDescripti
}
Tim Musschoot
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
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
"HKEY_LOCAL_MACHINE\\Syste
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'