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.

105 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. dialogs.c
  5. Abstract:
  6. This file implements the dialog proc for server name page.
  7. Environment:
  8. WIN32 User Mode
  9. Author:
  10. Wesley Witt (wesw) 17-Feb-1996
  11. --*/
  12. #include "wizard.h"
  13. #pragma hdrstop
  14. LRESULT
  15. ServerNameDlgProc(
  16. HWND hwnd,
  17. UINT msg,
  18. WPARAM wParam,
  19. LPARAM lParam
  20. )
  21. {
  22. switch( msg ) {
  23. case WM_INITDIALOG:
  24. {
  25. PPRINTER_INFO_4 PrinterInfo;
  26. DWORD CountPrinters;
  27. SendDlgItemMessage( hwnd, IDC_PRINTER_NAME, EM_SETLIMITTEXT, LT_PRINTER_NAME, 0 );
  28. PrinterInfo = MyEnumPrinters( NULL, 4, &CountPrinters, 0);
  29. if (PrinterInfo && CountPrinters == 1) {
  30. if (IsPrinterFaxPrinter( PrinterInfo[0].pPrinterName )) {
  31. SetDlgItemText( hwnd, IDC_PRINTER_NAME, PrinterInfo[0].pPrinterName );
  32. }
  33. }
  34. SetDlgItemText( hwnd, IDC_LABEL_PRINTERNAME, GetString(IDS_LABEL_PRINTERNAME) );
  35. SetDlgItemText( hwnd, IDC_PRINTER_NAME, GetString(IDS_DEFAULT_PRINTER_NAME) );
  36. }
  37. break;
  38. case WM_NOTIFY:
  39. switch( ((LPNMHDR)lParam)->code ) {
  40. case PSN_SETACTIVE:
  41. if (Unattended) {
  42. UnAttendGetAnswer(
  43. UAA_PRINTER_NAME,
  44. (LPBYTE) WizData.PrinterName,
  45. LT_PRINTER_NAME
  46. );
  47. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  48. return TRUE;
  49. }
  50. if (InstallMode != INSTALL_NEW) {
  51. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  52. return TRUE;
  53. }
  54. break;
  55. case PSN_WIZNEXT:
  56. SendDlgItemMessage(
  57. hwnd,
  58. IDC_PRINTER_NAME,
  59. WM_GETTEXT,
  60. LT_PRINTER_NAME,
  61. (LPARAM) WizData.PrinterName
  62. );
  63. if (!WizData.PrinterName[0]) {
  64. PopUpMsg( hwnd, IDS_PRINTER_NAME, TRUE, 0 );
  65. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  66. return TRUE;
  67. }
  68. if (_tcschr( WizData.PrinterName, TEXT('\\')) ||
  69. _tcschr( WizData.PrinterName, TEXT('!')) ||
  70. _tcschr( WizData.PrinterName, TEXT(','))){
  71. PopUpMsg( hwnd, IDS_INVALID_LOCAL_PRINTER_NAME, TRUE, 0 );
  72. ///Don't allow moving to the next page.
  73. SetWindowLong( hwnd, DWL_MSGRESULT, -1 );
  74. return TRUE;
  75. }
  76. break;
  77. }
  78. break;
  79. }
  80. return FALSE;
  81. }