CPrintDialog::GetDeviceName

CString GetDeviceName( ) const;

Return Value

The name of the currently selected printer.

Remarks

Call this function after calling DoModal to retrieve the name of the currently selected printer.

Example

This code fragment shows the user's default printer name and the port it is connected to, along with the spooler name the printer uses. The code might show a message box that says, "Your default printer is HP LaserJet IIIP on \\server\share using winspool.", for 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);
}

CPrintDialog OverviewClass MembersHierarchy Chart

See Also   CPrintDialog::GetDriverName, CPrintDialog::GetDevMode, CPrintDialog::GetPortName