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.

122 lines
2.4 KiB

  1. //____________________________________________________________________________
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1996.
  5. //
  6. // File: uiutil.hxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 3/7/1996 RaviR Created
  15. //
  16. //____________________________________________________________________________
  17. #ifndef _UIUTIL_HXX_
  18. #define _UIUTIL_HXX_
  19. #include "..\folderui\util.hxx"
  20. void
  21. SchedUIErrorDialog(
  22. HWND hwnd,
  23. int idsErrMsg,
  24. LONG error,
  25. UINT idsHelpHint = 0);
  26. inline
  27. void
  28. I_SetDlgItemText(
  29. HWND hDlg,
  30. int idCtrl,
  31. LPWSTR pwsz)
  32. {
  33. #ifdef UNICODE
  34. SetDlgItemText(hDlg, idCtrl, pwsz);
  35. #else
  36. TCHAR tcBuff[MAX_PATH+1];
  37. UnicodeToAnsi(tcBuff, pwsz, MAX_PATH+1);
  38. SetDlgItemText(hDlg, idCtrl, tcBuff);
  39. #endif
  40. }
  41. inline
  42. UINT
  43. I_GetDlgItemText(
  44. HWND hDlg, // handle of dialog box
  45. int nIDDlgItem, // identifier of control
  46. LPWSTR lpString, // address of buffer for text
  47. int nMaxCount) // maximum size of string
  48. {
  49. #ifdef UNICODE
  50. return GetDlgItemText(hDlg, nIDDlgItem, lpString, nMaxCount);
  51. #else
  52. CHAR cBuff[MAX_PATH+1];
  53. UINT uiRet = GetDlgItemText(hDlg, nIDDlgItem, cBuff, nMaxCount);
  54. if (uiRet > 0)
  55. {
  56. AnsiToUnicode(lpString, cBuff, nMaxCount);
  57. }
  58. return uiRet;
  59. #endif
  60. }
  61. inline void Spin_SetRange(HWND hDlg, int id, WORD wMin, WORD wMax)
  62. {
  63. SendDlgItemMessage(hDlg, id, UDM_SETRANGE, 0, MAKELONG(wMax, wMin));
  64. }
  65. inline DWORD Spin_GetPos(HWND hDlg, int id)
  66. {
  67. return (DWORD)SendDlgItemMessage(hDlg, id, UDM_GETPOS, 0, 0);
  68. }
  69. inline WORD Spin_SetPos(HWND hDlg, int id, WORD wPos)
  70. {
  71. return (WORD)SendDlgItemMessage(hDlg, id, UDM_SETPOS, 0, MAKELONG(wPos, 0));
  72. }
  73. inline void Spin_Disable(HWND hDlg, int id)
  74. {
  75. HWND hBuddy = (HWND)SendDlgItemMessage(hDlg, id, UDM_GETBUDDY, 0, 0);
  76. SetWindowText(hBuddy, TEXT(""));
  77. EnableWindow(hBuddy, FALSE);
  78. EnableWindow(GetDlgItem(hDlg, id), FALSE);
  79. }
  80. inline void Spin_Enable(HWND hDlg, int id, WORD wPos)
  81. {
  82. HWND hBuddy = (HWND)SendDlgItemMessage(hDlg, id, UDM_GETBUDDY, 0, 0);
  83. EnableWindow(hBuddy, TRUE);
  84. EnableWindow(GetDlgItem(hDlg, id), TRUE);
  85. Spin_SetPos(hDlg, id, wPos);
  86. }
  87. //
  88. // MAX_DP_TIME_FORMAT - should be large enough to hold hh sep mm tt
  89. //
  90. #define MAX_DP_TIME_FORMAT 30
  91. void
  92. UpdateTimeFormat(
  93. LPTSTR tszTimeFormat,
  94. ULONG cchTimeFormat);
  95. #endif // _UIUTIL_HXX_