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.

107 lines
2.5 KiB

  1. //____________________________________________________________________________
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1996.
  5. //
  6. // File: uiutil.cxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 3/20/1996 RaviR Created
  15. //
  16. //____________________________________________________________________________
  17. #include "..\pch\headers.hxx"
  18. #pragma hdrstop
  19. #include "..\folderui\macros.h"
  20. #include "..\inc\resource.h"
  21. #include "rc.h"
  22. #include <mstask.h> // Necessary for schedui.hxx inclusion.
  23. #include "schedui.hxx"
  24. #include <misc.hxx>
  25. #define ERROR_STRING_BUFFER_SIZE 2048
  26. #define ERROR_TITLE_BUFFER_SIZE 256
  27. extern HINSTANCE g_hInstance;
  28. void
  29. SchedUIErrorDialog(
  30. HWND hwnd,
  31. int idsErrMsg,
  32. LONG error,
  33. UINT idsHelpHint)
  34. {
  35. TCHAR szBuf1[ERROR_TITLE_BUFFER_SIZE];
  36. //
  37. // Obtain the error message string.
  38. //
  39. LPTSTR ptszErrMsg = ComposeErrorMsg(idsErrMsg,
  40. (DWORD)error,
  41. idsHelpHint,
  42. FALSE);
  43. if (ptszErrMsg == NULL)
  44. {
  45. return;
  46. }
  47. LoadString(g_hInstance, IDS_SCHEDULER_NAME, szBuf1, ARRAYLEN(szBuf1));
  48. MessageBox(hwnd, ptszErrMsg, szBuf1,
  49. MB_APPLMODAL | MB_ICONEXCLAMATION | MB_OK);
  50. LocalFree(ptszErrMsg);
  51. }
  52. //+--------------------------------------------------------------------------
  53. //
  54. // Function: SchedUIMessageDialog
  55. //
  56. // Synopsis: Display a message box and return result of user selection.
  57. //
  58. // Arguments: [hwnd] - parent window
  59. // [idsMsg] - resource id of string to load
  60. // [uType] - MB_* flags
  61. // [pszInsert] - NULL or string to insert
  62. //
  63. // Returns: Result of MessageBox call
  64. //
  65. // History: 5-19-1997 DavidMun Commented, added pszInsert
  66. //
  67. //---------------------------------------------------------------------------
  68. int
  69. SchedUIMessageDialog(
  70. HWND hwnd,
  71. int idsMsg,
  72. UINT uType,
  73. LPTSTR pszInsert)
  74. {
  75. TCHAR szBuf1[ERROR_STRING_BUFFER_SIZE];
  76. TCHAR szBuf2[ERROR_STRING_BUFFER_SIZE];
  77. if (pszInsert != 0)
  78. {
  79. LoadString(g_hInstance, idsMsg, szBuf1, ARRAYLEN(szBuf1));
  80. wsprintf(szBuf2, szBuf1, pszInsert);
  81. }
  82. else
  83. {
  84. LoadString(g_hInstance, idsMsg, szBuf2, ARRAYLEN(szBuf2));
  85. }
  86. LoadString(g_hInstance, IDS_SCHEDULER_NAME, szBuf1, ARRAYLEN(szBuf1));
  87. return MessageBox(hwnd, szBuf2, szBuf1, uType);
  88. }