Leaked source code of windows server 2003
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.

286 lines
11 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1997 Active Voice Corporation. All Rights Reserved.
  4. //
  5. // Active Agent(r) and Unified Communications(tm) are trademarks of Active Voice Corporation.
  6. //
  7. // Other brand and product names used herein are trademarks of their respective owners.
  8. //
  9. // The entire program and user interface including the structure, sequence, selection,
  10. // and arrangement of the dialog, the exclusively "yes" and "no" choices represented
  11. // by "1" and "2," and each dialog message are protected by copyrights registered in
  12. // the United States and by international treaties.
  13. //
  14. // Protected by one or more of the following United States patents: 5,070,526, 5,488,650,
  15. // 5,434,906, 5,581,604, 5,533,102, 5,568,540, 5,625,676, 5,651,054.
  16. //
  17. // Active Voice Corporation
  18. // Seattle, Washington
  19. // USA
  20. //
  21. /////////////////////////////////////////////////////////////////////////////////////////
  22. ////
  23. // tmeter.h - TrackMeter custom control
  24. ////
  25. ////
  26. // public
  27. ////
  28. //#if 0
  29. //#include "winlocal.h"
  30. //#else
  31. #ifndef STRICT
  32. #define STRICT
  33. #endif
  34. #include <windows.h>
  35. #include <windowsx.h>
  36. #define DLLEXPORT __declspec(dllexport)
  37. #define DECLARE_HANDLE32 DECLARE_HANDLE
  38. //#endif
  39. #include <commctrl.h>
  40. // control styles
  41. //
  42. #define TMS_HORZ TBS_HORZ
  43. #define TMS_VERT TBS_VERT
  44. #define TMS_NOTHUMB TBS_NOTHUMB
  45. // control messages
  46. //
  47. #define TMM_GETPOS TBM_GETPOS
  48. #define TMM_SETPOS TBM_SETPOS
  49. #define TMM_GETRANGEMIN TBM_GETRANGEMIN
  50. #define TMM_SETRANGEMIN TBM_SETRANGEMIN
  51. #define TMM_GETRANGEMAX TBM_GETRANGEMAX
  52. #define TMM_SETRANGEMAX TBM_SETRANGEMAX
  53. #define TMM_SETRANGE TBM_SETRANGE
  54. #define TMM_GETLEVEL (WM_USER + 100)
  55. #define TMM_SETLEVEL (WM_USER + 101)
  56. #define TMM_GETCOLOR (WM_USER + 102)
  57. #define TMM_SETCOLOR (WM_USER + 103)
  58. #define TRACKMETER_MODULE TEXT("avMeter.dll")
  59. #define TRACKMETER_CLASS TEXT("TrackMeterClass")
  60. #define TRACKMETER_CLASS_A "TrackMeterClass"
  61. // TrackMeter_Init - initialize control library
  62. // <lpLibFileName> (i) address of filename of executable module
  63. // <hInst> (i) module handle used to get library path
  64. // NULL use module used to create calling process
  65. // <dwFlags> (i) reserved; must be zero
  66. // returns HMODULE of control library, NULL if error
  67. //
  68. #ifdef __LOADLIB_H__
  69. #define TrackMeter_Init(hInst, dwFlags) \
  70. (HMODULE) LoadLibraryPath(TRACKMETER_MODULE, hInst, dwFlags)
  71. #else
  72. #define TrackMeter_Init(hInst, dwFlags) \
  73. (HMODULE) LoadLibrary(TRACKMETER_MODULE)
  74. #endif
  75. // TrackMeter_Term - shuts down control library
  76. // <hModule> (i) handle returned from TrackMeter_Init
  77. // returns non-zero if success
  78. //
  79. #define TrackMeter_Term(hModule) \
  80. (BOOL) FreeLibrary(hModule)
  81. // TrackMeter_Create - create TrackMeter control
  82. // <dwStyle> (i) style flags
  83. // TMS_HORZ horizontal control (default)
  84. // TMS_VERT vertical control $FIXUP - not supported yet
  85. // TMS_NOTHUMB do not display thumb
  86. // WS_CHILD | WS_VISIBLE and other standard window styles
  87. // <x> (i) horizontal position of control
  88. // <y> (i) vertical position of control
  89. // <cx> (i) width of control
  90. // <cy> (i) height of control
  91. // <hwndParent> (i) handle to parent of control
  92. // <hInst> (i) instance of module associated with control
  93. // returns hwnd of control, NULL if error
  94. //
  95. #define TrackMeter_Create(dwStyle, x, y, cx, cy, hwndParent, hInst) \
  96. (HWND) CreateWindowEx(0L, TRACKMETER_CLASS, TEXT(""), \
  97. dwStyle, x, y, cx, cy, hwndParent, NULL, hInst, NULL)
  98. // TrackMeter_Destroy - destroy TrackMeter control
  99. // <hwnd> (i) handle returned by TrackMeter_Create
  100. // returns non-zero if success
  101. //
  102. #define TrackMeter_Destroy(hwnd) \
  103. (BOOL) DestroyWindow(hwnd)
  104. // TrackMeter_GetPos - get current position of slider
  105. // <hwnd> (i) handle returned by TrackMeter_Create
  106. // returns 32-bit slider position
  107. //
  108. #define TrackMeter_GetPos(hwnd) \
  109. (LONG)(DWORD) SNDMSG(hwnd, TMM_GETPOS, 0, 0)
  110. /* LONG Cls_OnTMMGetPos(HWND hwnd) */
  111. #define HANDLE_TMM_GETPOS(hwnd, wParam, lParam, fn) \
  112. (LRESULT)(DWORD)(long)(fn)(hwnd)
  113. #define FORWARD_TMM_GETPOS(hwnd, fn) \
  114. (LONG)(DWORD)(fn)((hwnd), TMM_GETPOS, 0L, 0L)
  115. // TrackMeter_SetPos - set current position of slider
  116. // <hwnd> (i) handle returned by TrackMeter_Create
  117. // <lPosition> (i) new position for slider
  118. // <fRedraw> (i) redraw control at new position if TRUE
  119. // returns nothing
  120. //
  121. #define TrackMeter_SetPos(hwnd, lPosition, fRedraw) \
  122. (void) SNDMSG(hwnd, TMM_SETPOS, (WPARAM) fRedraw, (LPARAM) lPosition)
  123. /* void Cls_OnTMMSetPos(HWND hwnd, LONG lPosition, BOOL fRedraw) */
  124. #define HANDLE_TMM_SETPOS(hwnd, wParam, lParam, fn) \
  125. ((fn)((hwnd), (LONG)(lParam), (BOOL)(wParam)), 0L)
  126. #define FORWARD_TMM_SETPOS(hwnd, lPosition, fRedraw, fn) \
  127. (void)(fn)((hwnd), TMM_SETPOS, (WPARAM)(BOOL)(fRedraw), (LPARAM)(LONG)(lPosition))
  128. // TrackMeter_GetRangeMin - get minimum position of slider
  129. // <hwnd> (i) handle returned by TrackMeter_Create
  130. // returns 32-bit slider minimum position
  131. //
  132. #define TrackMeter_GetRangeMin(hwnd) \
  133. (LONG)(DWORD) SNDMSG(hwnd, TMM_GETRANGEMIN, 0, 0)
  134. /* LONG Cls_OnTMMGetRangeMin(HWND hwnd) */
  135. #define HANDLE_TMM_GETRANGEMIN(hwnd, wParam, lParam, fn) \
  136. (LRESULT)(DWORD)(long)(fn)(hwnd)
  137. #define FORWARD_TMM_GETRANGEMIN(hwnd, fn) \
  138. (LONG)(DWORD)(fn)((hwnd), TMM_GETRANGEMIN, 0L, 0L)
  139. // TrackMeter_SetRangeMin - set minimum position of slider
  140. // <hwnd> (i) handle returned by TrackMeter_Create
  141. // <lMinimum> (i) new minimum position for slider
  142. // <fRedraw> (i) redraw control if TRUE
  143. // returns nothing
  144. //
  145. #define TrackMeter_SetRangeMin(hwnd, lMinimum, fRedraw) \
  146. (void) SNDMSG(hwnd, TMM_SETRANGEMIN, (WPARAM) fRedraw, (LPARAM) lMinimum)
  147. /* void Cls_OnTMMSetRangeMin(HWND hwnd, LONG lMinimum, BOOL fRedraw) */
  148. #define HANDLE_TMM_SETRANGEMIN(hwnd, wParam, lParam, fn) \
  149. ((fn)((hwnd), (LONG)(lParam), (BOOL)(wParam)), 0L)
  150. #define FORWARD_TMM_SETRANGEMIN(hwnd, lMinimum, fRedraw, fn) \
  151. (void)(fn)((hwnd), TMM_SETRANGEMIN, (WPARAM)(BOOL)(fRedraw), (LPARAM)(LONG)(lMinimum))
  152. // TrackMeter_GetRangeMax - get maximum position of slider
  153. // <hwnd> (i) handle returned by TrackMeter_Create
  154. // returns 32-bit slider maximum position
  155. //
  156. #define TrackMeter_GetRangeMax(hwnd) \
  157. (LONG)(DWORD) SNDMSG(hwnd, TMM_GETRANGEMAX, 0, 0)
  158. /* LONG Cls_OnTMMGetRangeMax(HWND hwnd) */
  159. #define HANDLE_TMM_GETRANGEMAX(hwnd, wParam, lParam, fn) \
  160. (LRESULT)(DWORD)(long)(fn)(hwnd)
  161. #define FORWARD_TMM_GETRANGEMAX(hwnd, fn) \
  162. (LONG)(DWORD)(fn)((hwnd), TMM_GETRANGEMAX, 0L, 0L)
  163. // TrackMeter_SetRangeMax - set maximum position of slider
  164. // <hwnd> (i) handle returned by TrackMeter_Create
  165. // <lMaximum> (i) new maximum position for slider
  166. // <fRedraw> (i) redraw control if TRUE
  167. // returns nothing
  168. //
  169. #define TrackMeter_SetRangeMax(hwnd, lMaximum, fRedraw) \
  170. (void) SNDMSG(hwnd, TMM_SETRANGEMAX, (WPARAM) fRedraw, (LPARAM) lMaximum)
  171. /* void Cls_OnTMMSetRangeMax(HWND hwnd, LONG lMaximum, BOOL fRedraw) */
  172. #define HANDLE_TMM_SETRANGEMAX(hwnd, wParam, lParam, fn) \
  173. ((fn)((hwnd), (LONG)(lParam), (BOOL)(wParam)), 0L)
  174. #define FORWARD_TMM_SETRANGEMAX(hwnd, lMaximum, fRedraw, fn) \
  175. (void)(fn)((hwnd), TMM_SETRANGEMAX, (WPARAM)(BOOL)(fRedraw), (LPARAM)(LONG)(lMaximum))
  176. // TrackMeter_SetRange - set minimum and maximum positions of slider
  177. // <hwnd> (i) handle returned by TrackMeter_Create
  178. // <lMinimum> (i) new minimum position for slider
  179. // <lMaximum> (i) new maximum position for slider
  180. // <fRedraw> (i) redraw control if TRUE
  181. // returns nothing
  182. //
  183. #define TrackMeter_SetRange(hwnd, lMinimum, lMaximum, fRedraw) \
  184. (void) SNDMSG(hwnd, TMM_SETRANGE, (WPARAM) fRedraw, \
  185. (LPARAM) MAKELONG(lMinimum, lMaximum))
  186. /* void Cls_OnTMMSetRange(HWND hwnd, LONG lMinimum, LONG lMaximum, BOOL fRedraw) */
  187. #define HANDLE_TMM_SETRANGE(hwnd, wParam, lParam, fn) \
  188. ((fn)((hwnd), (LONG)LOWORD(lParam), (LONG)HIWORD(lParam), (BOOL)(wParam)), 0L)
  189. #define FORWARD_TMM_SETRANGE(hwnd, lMinimum, lMaximum, fRedraw, fn) \
  190. (void)(fn)((hwnd), TMM_SETRANGE, (WPARAM)(BOOL)(fRedraw), (LPARAM)MAKELONG(lMinimum, lMaximum))
  191. // TrackMeter_GetLevel - get current level of meter
  192. // <hwnd> (i) handle returned by TrackMeter_Create
  193. // returns 32-bit meter level
  194. //
  195. #define TrackMeter_GetLevel(hwnd) \
  196. (LONG)(DWORD) SNDMSG(hwnd, TMM_GETLEVEL, 0, 0)
  197. /* LONG Cls_OnTMMGetLevel(HWND hwnd) */
  198. #define HANDLE_TMM_GETLEVEL(hwnd, wParam, lParam, fn) \
  199. (LRESULT)(DWORD)(long)(fn)(hwnd)
  200. #define FORWARD_TMM_GETLEVEL(hwnd, fn) \
  201. (LONG)(DWORD)(fn)((hwnd), TMM_GETLEVEL, 0L, 0L)
  202. // TrackMeter_SetLevel - set current level of meter
  203. // <hwnd> (i) handle returned by TrackMeter_Create
  204. // <lLevel> (i) new level for meter
  205. // <fRedraw> (i) redraw control at new level if TRUE
  206. // returns nothing
  207. //
  208. #define TrackMeter_SetLevel(hwnd, lLevel, fRedraw) \
  209. (void) SNDMSG(hwnd, TMM_SETLEVEL, (WPARAM) fRedraw, (LPARAM) lLevel)
  210. /* void Cls_OnTMMSetLevel(HWND hwnd, LONG lLevel, BOOL fRedraw) */
  211. #define HANDLE_TMM_SETLEVEL(hwnd, wParam, lParam, fn) \
  212. ((fn)((hwnd), (LONG)(lParam), (BOOL)(wParam)), 0L)
  213. #define FORWARD_TMM_SETLEVEL(hwnd, lLevel, fRedraw, fn) \
  214. (void)(fn)((hwnd), TMM_SETLEVEL, (WPARAM)(BOOL)(fRedraw), (LPARAM)(LONG)(lLevel))
  215. // TrackMeter_GetColor - get current color for control element
  216. // <hwnd> (i) handle returned by TrackMeter_Create
  217. // <elem> (i) which element color to get
  218. // see TMCR_ #defines below
  219. // returns 32-bit COLORREF
  220. //
  221. #define TrackMeter_GetColor(hwnd, elem) \
  222. (COLORREF)(DWORD) SNDMSG(hwnd, TMM_GETCOLOR, (WPARAM) 0, \
  223. (LPARAM) MAKELONG(elem, 0))
  224. /* COLORREF Cls_OnTMMGetColor(HWND hwnd, UINT elem) */
  225. #define HANDLE_TMM_GETCOLOR(hwnd, wParam, lParam, fn) \
  226. (LRESULT)(DWORD)(long)(fn)(hwnd, (UINT)LOWORD(lParam))
  227. #define FORWARD_TMM_GETCOLOR(hwnd, fn) \
  228. (COLORREF)(DWORD)(fn)((hwnd), TMM_GETCOLOR, (WAPRAM) 0L, \
  229. (LPARAM)MAKELONG((UINT)(elem), 0))
  230. // TrackMeter_SetColor - set color for control element
  231. // <hwnd> (i) handle returned by TrackMeter_Create
  232. // <cr> (i) COLORREF for specified element
  233. // <elem> (i) which element gets the specified color
  234. // see TMCR_ #defines below
  235. // <fRedraw> (i) redraw control if TRUE
  236. // returns nothing
  237. //
  238. #define TrackMeter_SetColor(hwnd, cr, elem, fRedraw) \
  239. (void) SNDMSG(hwnd, TMM_SETCOLOR, (WPARAM) cr, \
  240. (LPARAM) MAKELONG(elem, fRedraw))
  241. /* void Cls_OnTMMSetColor(HWND hwnd, COLORREF cr, UINT elem, BOOL fRedraw) */
  242. #define HANDLE_TMM_SETCOLOR(hwnd, wParam, lParam, fn) \
  243. ((fn)((hwnd), (COLORREF)(wParam), (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)), 0L)
  244. #define FORWARD_TMM_SETCOLOR(hwnd, cr, elem, fRedraw, fn) \
  245. (void)(fn)((hwnd), TMM_SETCOLOR, (WPARAM)(COLORREF)(cr), \
  246. (LPARAM)MAKELONG((UINT)(elem), (BOOL)(fRedraw)))
  247. // <elem> values for ThumbTrack_GetColor and ThumbTrack_SetColor
  248. //
  249. #define TMCR_CTRLBACKGROUND 1
  250. #define TMCR_FOCUSBACKGROUND 2
  251. #define TMCR_TRACKBACKGROUND 3
  252. #define TMCR_TRACKLIGHT 4
  253. #define TMCR_TRACKSHADOW 5
  254. #define TMCR_TRACKDKSHADOW 6
  255. #define TMCR_LEVEL 7
  256. #define TMCR_THUMBFACE 8
  257. #define TMCR_THUMBFACEPRESSED 9
  258. #define TMCR_THUMBLIGHT 10
  259. #define TMCR_THUMBSHADOW 11
  260. #define TMCR_THUMBDKSHADOW 12
  261. #define TMCR_MAX 32