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.

110 lines
2.8 KiB

  1. #include "nc.h"
  2. #pragma hdrstop
  3. BOOL
  4. CreateNewAccount(
  5. HWND hDlg
  6. );
  7. extern "C"
  8. LRESULT CALLBACK
  9. FaxDevDlgProc(
  10. HWND hwnd,
  11. UINT message,
  12. WPARAM wParam,
  13. LPARAM lParam
  14. )
  15. {
  16. static BOOL IgnoreChange = FALSE;
  17. LPNMHDR pNMHdr;
  18. WCHAR Buffer[4096];
  19. switch( message ) {
  20. case WM_INITDIALOG:
  21. break;
  22. case WM_COMMAND:
  23. if (HIWORD(wParam) == EN_CHANGE && !IgnoreChange) {
  24. PropSheet_Changed( GetParent(hwnd), hwnd );
  25. }
  26. if (HIWORD(wParam) == BN_CLICKED) {
  27. CreateNewAccount( hwnd );
  28. }
  29. break;
  30. case WM_NOTIFY:
  31. pNMHdr = (LPNMHDR) lParam;
  32. switch (pNMHdr->code) {
  33. case PSN_SETACTIVE:
  34. IgnoreChange = TRUE;
  35. SetDlgItemText( hwnd, IDC_SERVER, ConfigData.ServerName );
  36. SetDlgItemText( hwnd, IDC_USERNAME, ConfigData.UserName );
  37. SetDlgItemText( hwnd, IDC_PASSWORD, ConfigData.Password );
  38. IgnoreChange = FALSE;
  39. break;
  40. case PSN_APPLY:
  41. GetDlgItemText( hwnd, IDC_SERVER, Buffer, sizeof(Buffer)/sizeof(WCHAR) );
  42. MemFree( ConfigData.ServerName );
  43. ConfigData.ServerName = StringDup( Buffer );
  44. GetDlgItemText( hwnd, IDC_USERNAME, Buffer, sizeof(Buffer)/sizeof(WCHAR) );
  45. MemFree( ConfigData.UserName );
  46. ConfigData.UserName = StringDup( Buffer );
  47. GetDlgItemText( hwnd, IDC_PASSWORD, Buffer, sizeof(Buffer)/sizeof(WCHAR) );
  48. MemFree( ConfigData.Password );
  49. ConfigData.Password = StringDup( Buffer );
  50. SetNcConfig( &ConfigData );
  51. PropSheet_UnChanged( GetParent(hwnd), hwnd );
  52. break;
  53. }
  54. break;
  55. case WM_HELP:
  56. case WM_CONTEXTMENU:
  57. break;
  58. }
  59. return FALSE;
  60. }
  61. BOOL WINAPI
  62. FaxDevConfigure(
  63. OUT HPROPSHEETPAGE *PropSheetPage
  64. )
  65. {
  66. PROPSHEETPAGE psp;
  67. if (MyHeapHandle == NULL) {
  68. MyHeapHandle = GetProcessHeap();
  69. HeapInitialize( MyHeapHandle, NULL, NULL, 0 );
  70. InitCommonControls();
  71. InitializeStringTable();
  72. GetNcConfig( &ConfigData );
  73. }
  74. psp.dwSize = sizeof(PROPSHEETPAGE);
  75. psp.dwFlags = PSP_DEFAULT;
  76. psp.hInstance = MyhInstance;
  77. psp.pszTemplate = MAKEINTRESOURCE( IDD_CONFIG );
  78. psp.hIcon = NULL;
  79. psp.pszTitle = NULL;
  80. psp.pfnDlgProc = (DLGPROC) FaxDevDlgProc;
  81. psp.lParam = 0;
  82. psp.pfnCallback = NULL;
  83. psp.pcRefParent = NULL;
  84. *PropSheetPage = CreatePropertySheetPage( &psp );
  85. return *PropSheetPage != NULL;
  86. }