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.

79 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. dialogs.c
  5. Abstract:
  6. This file implements the dialog proc for the
  7. printer name page.
  8. Environment:
  9. WIN32 User Mode
  10. Author:
  11. Wesley Witt (wesw) 17-Feb-1996
  12. --*/
  13. #include "wizard.h"
  14. #pragma hdrstop
  15. LRESULT
  16. PrinterNameDlgProc(
  17. HWND hwnd,
  18. UINT message,
  19. WPARAM wParam,
  20. LPARAM lParam
  21. )
  22. {
  23. static LPTSTR PrinterName;
  24. TCHAR Buffer[LT_PRINTER_NAME+1];
  25. switch( message ) {
  26. case WM_INITDIALOG:
  27. SendDlgItemMessage( hwnd, IDC_SERVER_NAME, EM_SETLIMITTEXT, LT_PRINTER_NAME, 0 );
  28. PrinterName = (LPTSTR) lParam;
  29. break;
  30. case WM_COMMAND:
  31. switch( wParam ) {
  32. case IDCANCEL:
  33. EndDialog( hwnd, 0 );
  34. return TRUE;
  35. case IDOK:
  36. SendDlgItemMessage(
  37. hwnd,
  38. IDC_SERVER_NAME,
  39. WM_GETTEXT,
  40. LT_PRINTER_NAME,
  41. (LPARAM) Buffer
  42. );
  43. if (!Buffer[0]) {
  44. PopUpMsg( hwnd, IDS_PRINTER_NAME, TRUE, 0 );
  45. return FALSE;
  46. }
  47. if (Buffer[0] == TEXT('\\') && Buffer[1] == TEXT('\\')) {
  48. _tcscpy( PrinterName, Buffer );
  49. } else {
  50. PrinterName[0] = TEXT('\\');
  51. PrinterName[1] = TEXT('\\');
  52. PrinterName[2] = 0;
  53. _tcscat( PrinterName, Buffer );
  54. }
  55. EndDialog( hwnd, 1 );
  56. return TRUE;
  57. }
  58. break;
  59. }
  60. return FALSE;
  61. }