Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.3 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1995 - 1997
  3. All rights reserved.
  4. Module Name:
  5. defprn.cxx
  6. Abstract:
  7. Default printer.
  8. Author:
  9. Steve Kiraly (SteveKi) 06-Feb-1997
  10. Revision History:
  11. --*/
  12. #include "precomp.hxx"
  13. #pragma hdrstop
  14. #include "defprn.hxx"
  15. /********************************************************************
  16. PrintUI specific default printer manipulation code.
  17. ********************************************************************/
  18. DEFAULT_PRINTER
  19. CheckDefaultPrinter(
  20. IN LPCTSTR pszPrinter OPTIONAL
  21. )
  22. /*++
  23. Routine Description:
  24. Determines the default printer status.
  25. Arguments:
  26. pszPrinter - Check if this printer is the default (optional).
  27. Return Value:
  28. kNoDefault - No default printer exists.
  29. kDefault - pszPrinter is the default printer.
  30. kOtherDefault - Default printer exists, but it's not pszPrinter
  31. (or pszPrinter was not passed in).
  32. --*/
  33. {
  34. DEFAULT_PRINTER bRetval = kNoDefault;
  35. DWORD dwDefaultSize = kPrinterBufMax;
  36. TStatusB bStatus;
  37. TCHAR szDefault[kPrinterBufMax];
  38. //
  39. // Get the default printer.
  40. //
  41. bStatus DBGCHK = GetDefaultPrinter( szDefault, &dwDefaultSize );
  42. if( bStatus )
  43. {
  44. if( pszPrinter )
  45. {
  46. //
  47. // Check for a match using the printer name that
  48. // was passed to this routine.
  49. //
  50. if( !_tcsicmp( szDefault, pszPrinter ) )
  51. {
  52. bRetval = kDefault;
  53. }
  54. else
  55. {
  56. //
  57. // Printer specified by pszPrinter is not the default
  58. // printer, i.e. some other printer is the default.
  59. //
  60. bRetval = kOtherDefault;
  61. }
  62. }
  63. else
  64. {
  65. //
  66. // A specific printer name was not passed therefore the
  67. // printer is not the default some other printer is the
  68. // default.
  69. //
  70. bRetval = kOtherDefault;
  71. }
  72. }
  73. else
  74. {
  75. //
  76. // We could not get the default printer no printer is the
  77. // set as the default.
  78. //
  79. bRetval = kNoDefault;
  80. }
  81. return bRetval;
  82. }