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.

299 lines
15 KiB

  1. /*----------------------------------------------------------------------------*\
  2. *
  3. * MCIWnd
  4. *
  5. * MCIWnd window class header file.
  6. *
  7. * the MCIWnd window class is a window class for controling MCI devices
  8. * MCI devices include, wave files, midi files, AVI Video, cd audio,
  9. * vcr, video disc, and others..
  10. *
  11. * to learn more about MCI and mci command sets see the
  12. * "Microsoft Multimedia Programmers's guide" in the Win31 SDK
  13. *
  14. * the easiest use of the MCIWnd class is like so:
  15. *
  16. * hwnd = MCIWndCreate(hwndParent, hInstance, 0, "chimes.wav");
  17. * ...
  18. * MCIWndPlay(hwnd);
  19. * MCIWndStop(hwnd);
  20. * MCIWndPause(hwnd);
  21. * ....
  22. * MCIWndDestroy(hwnd);
  23. *
  24. * this will create a window with a play/pause, stop and a playbar
  25. * and start the wave file playing.
  26. *
  27. * mciwnd.h defines macros for all the most common MCI commands, but
  28. * any string command can be used if needed.
  29. *
  30. * Note: unlike the mciSendString() API, no alias or file name needs
  31. * to be specifed, since the device to use is implied by the window handle.
  32. *
  33. * MCIWndSendString(hwnd, "setaudio stream to 2");
  34. *
  35. * (C) Copyright Microsoft Corp. 1991, 1992, 1993. All rights reserved.
  36. *
  37. * You have a royalty-free right to use, modify, reproduce and
  38. * distribute the Sample Files (and/or any modified version) in
  39. * any way you find useful, provided that you agree that
  40. * Microsoft has no warranty obligations or liability for any
  41. * Sample Application Files.
  42. *
  43. * If you did not get this from Microsoft Sources, then it may not be the
  44. * most current version. This sample code in particular will be updated
  45. * and include more documentation.
  46. *
  47. * Sources are:
  48. * CompuServe: WINSDK forum, MDK section.
  49. * Anonymous FTP from ftp.uu.net vendor\microsoft\multimedia
  50. *
  51. *----------------------------------------------------------------------------*/
  52. #ifndef INC_MCIWND
  53. #define INC_MCIWND
  54. #ifdef __cplusplus
  55. // MFC Redefines SendMessage, so make sure we get the global one....
  56. #define MCIWndSM ::SendMessage /* SendMessage in C++*/
  57. #else
  58. #define MCIWndSM SendMessage /* SendMessage in C */
  59. #endif /* __cplusplus */
  60. #ifdef __cplusplus
  61. extern "C" {
  62. #endif
  63. #define MCIWND_WINDOW_CLASS "MCIWndClass"
  64. HWND FAR _cdecl _loadds MCIWndCreate(HWND hwndParent, HINSTANCE hInstance,
  65. DWORD dwStyle,LPSTR szFile);
  66. BOOL FAR _cdecl _loadds MCIWndRegisterClass();
  67. // Flags for the MCIWndOpen command
  68. #define MCIWNDOPENF_NEW 0x0001 // open a new file
  69. // window styles
  70. #define MCIWNDF_NOAUTOSIZEWINDOW 0x0001 // when movie size changes
  71. #define MCIWNDF_NOPLAYBAR 0x0002 // no toolbar
  72. #define MCIWNDF_NOAUTOSIZEMOVIE 0x0004 // when window size changes
  73. #define MCIWNDF_NOMENU 0x0008 // no popup menu from RBUTTONDOWN
  74. #define MCIWNDF_SHOWNAME 0x0010 // show name in caption
  75. #define MCIWNDF_SHOWPOS 0x0020 // show position in caption
  76. #define MCIWNDF_SHOWMODE 0x0040 // show mode in caption
  77. #define MCIWNDF_SHOWALL 0x0070 // show all
  78. #define MCIWNDF_NOTIFYMODE 0x0100 // tell parent of mode change
  79. #define MCIWNDF_NOTIFYPOS 0x0200 // tell parent of pos change
  80. #define MCIWNDF_NOTIFYSIZE 0x0400 // tell parent of size change
  81. #define MCIWNDF_NOTIFYMEDIA 0x0800 // tell parent of media change
  82. #define MCIWNDF_NOTIFYERROR 0x1000 // tell parent of an error
  83. #define MCIWNDF_NOTIFYALL 0x1F00 // tell all
  84. #define MCIWNDF_RECORD 0x2000 // Give a record button
  85. #define MCIWNDF_NOERRORDLG 0x4000 // Show Error Dlgs for MCI cmds?
  86. #define MCIWNDF_NOOPEN 0x8000 // Don't allow user to open things
  87. // can macros
  88. #define MCIWndCanPlay(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_PLAY,0,0)
  89. #define MCIWndCanRecord(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_RECORD,0,0)
  90. #define MCIWndCanSave(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_SAVE,0,0)
  91. #define MCIWndCanWindow(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_WINDOW,0,0)
  92. #define MCIWndCanEject(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_EJECT,0,0)
  93. #define MCIWndCanConfig(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_CONFIG,0,0)
  94. #define MCIWndPaletteKick(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_PALETTEKICK,0,0)
  95. #define MCIWndSave(hwnd, szFile) (LONG)MCIWndSM(hwnd, MCI_SAVE, 0, (LPARAM)(LPVOID)(szFile))
  96. #define MCIWndSaveDialog(hwnd) MCIWndSave(hwnd, -1)
  97. // if you dont give a device it will use the current device....
  98. #define MCIWndNew(hwnd, lp) (LONG)MCIWndSM(hwnd, MCIWNDM_NEW, 0, (LPARAM)(LPVOID)(lp))
  99. #define MCIWndRecord(hwnd) (LONG)MCIWndSM(hwnd, MCI_RECORD, 0, 0)
  100. #define MCIWndOpen(hwnd, sz, f) (LONG)MCIWndSM(hwnd, MCI_OPEN, (WPARAM)(UINT)(f),(LPARAM)(LPVOID)(sz))
  101. #define MCIWndOpenDialog(hwnd) MCIWndOpen(hwnd, -1, 0)
  102. #define MCIWndClose(hwnd) (LONG)MCIWndSM(hwnd, MCI_CLOSE, 0, 0)
  103. #define MCIWndPlay(hwnd) (LONG)MCIWndSM(hwnd, MCI_PLAY, 0, 0)
  104. #define MCIWndStop(hwnd) (LONG)MCIWndSM(hwnd, MCI_STOP, 0, 0)
  105. #define MCIWndPause(hwnd) (LONG)MCIWndSM(hwnd, MCI_PAUSE, 0, 0)
  106. #define MCIWndResume(hwnd) (LONG)MCIWndSM(hwnd, MCI_RESUME, 0, 0)
  107. #define MCIWndSeek(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCI_SEEK, 0, (LPARAM)(LONG)(lPos))
  108. #define MCIWndEject(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_EJECT, 0, 0)
  109. #define MCIWndHome(hwnd) MCIWndSeek(hwnd, MCIWND_START)
  110. #define MCIWndEnd(hwnd) MCIWndSeek(hwnd, MCIWND_END)
  111. #define MCIWndGetSource(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_GET_SOURCE, 0, (LPARAM)(LPRECT)(prc))
  112. #define MCIWndPutSource(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_PUT_SOURCE, 0, (LPARAM)(LPRECT)(prc))
  113. #define MCIWndGetDest(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_GET_DEST, 0, (LPARAM)(LPRECT)(prc))
  114. #define MCIWndPutDest(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_PUT_DEST, 0, (LPARAM)(LPRECT)(prc))
  115. #define MCIWndPlayReverse(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYREVERSE, 0, 0)
  116. #define MCIWndPlayFrom(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYFROM, 0, (LPARAM)(LONG)(lPos))
  117. #define MCIWndPlayTo(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYTO, 0, (LPARAM)(LONG)(lPos))
  118. #define MCIWndPlayFromTo(hwnd, lStart, lEnd) (MCIWndSeek(hwnd, lStart), MCIWndPlayTo(hwnd, lEnd))
  119. #define MCIWndGetDeviceID(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETDEVICEID, 0, 0)
  120. #define MCIWndGetAlias(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETALIAS, 0, 0)
  121. #define MCIWndGetMode(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETMODE, (WPARAM)(UINT)(len), (LPARAM)(LPSTR)(lp))
  122. #define MCIWndGetPosition(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETPOSITION, 0, 0)
  123. #define MCIWndGetPositionString(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETPOSITION, (WPARAM)(UINT)(len), (LPARAM)(LPSTR)(lp))
  124. #define MCIWndGetStart(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETSTART, 0, 0)
  125. #define MCIWndGetLength(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETLENGTH, 0, 0)
  126. #define MCIWndGetEnd(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETEND, 0, 0)
  127. #define MCIWndStep(hwnd, n) (LONG)MCIWndSM(hwnd, MCI_STEP, 0,(LPARAM)(long)(n))
  128. #define MCIWndDestroy(hwnd) (VOID)MCIWndSM(hwnd, WM_CLOSE, 0, 0)
  129. #define MCIWndSetZoom(hwnd,iZoom) (VOID)MCIWndSM(hwnd, MCIWNDM_SETZOOM, 0, (LPARAM)(UINT)(iZoom))
  130. #define MCIWndGetZoom(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETZOOM, 0, 0)
  131. #define MCIWndSetVolume(hwnd,iVol) (LONG)MCIWndSM(hwnd, MCIWNDM_SETVOLUME, 0, (LPARAM)(UINT)(iVol))
  132. #define MCIWndGetVolume(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETVOLUME, 0, 0)
  133. #define MCIWndSetSpeed(hwnd,iSpeed) (LONG)MCIWndSM(hwnd, MCIWNDM_SETSPEED, 0, (LPARAM)(UINT)(iSpeed))
  134. #define MCIWndGetSpeed(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETSPEED, 0, 0)
  135. #define MCIWndSetTimeFormat(hwnd, lp) (LONG)MCIWndSM(hwnd, MCIWNDM_SETTIMEFORMAT, 0, (LPARAM)(LPSTR)(lp))
  136. #define MCIWndGetTimeFormat(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETTIMEFORMAT, (WPARAM)(UINT)(len), (LPARAM)(LPSTR)(lp))
  137. #define MCIWndValidateMedia(hwnd) (VOID)MCIWndSM(hwnd, MCIWNDM_VALIDATEMEDIA, 0, 0)
  138. #define MCIWndSetRepeat(hwnd,f) (void)MCIWndSM(hwnd, MCIWNDM_SETREPEAT, 0, (LPARAM)(BOOL)(f))
  139. #define MCIWndGetRepeat(hwnd) (BOOL)MCIWndSM(hwnd, MCIWNDM_GETREPEAT, 0, 0)
  140. #define MCIWndUseFrames(hwnd) MCIWndSetTimeFormat(hwnd, "frames")
  141. #define MCIWndUseTime(hwnd) MCIWndSetTimeFormat(hwnd, "ms")
  142. #define MCIWndSetActiveTimer(hwnd, active) \
  143. (VOID)MCIWndSM(hwnd, MCIWNDM_SETACTIVETIMER, \
  144. (WPARAM)(UINT)(active), 0L)
  145. #define MCIWndSetInactiveTimer(hwnd, inactive) \
  146. (VOID)MCIWndSM(hwnd, MCIWNDM_SETINACTIVETIMER, \
  147. (WPARAM)(UINT)(inactive), 0L)
  148. #define MCIWndSetTimers(hwnd, active, inactive) \
  149. (VOID)MCIWndSM(hwnd, MCIWNDM_SETTIMERS,(WPARAM)(UINT)(active), \
  150. (LPARAM)(UINT)(inactive))
  151. #define MCIWndGetActiveTimer(hwnd) \
  152. (UINT)MCIWndSM(hwnd, MCIWNDM_GETACTIVETIMER, 0, 0L);
  153. #define MCIWndGetInactiveTimer(hwnd) \
  154. (UINT)MCIWndSM(hwnd, MCIWNDM_GETINACTIVETIMER, 0, 0L);
  155. #define MCIWndRealize(hwnd, fBkgnd) (LONG)MCIWndSM(hwnd, MCIWNDM_REALIZE,(WPARAM)(BOOL)(fBkgnd),0)
  156. #define MCIWndSendString(hwnd, sz) (LONG)MCIWndSM(hwnd, MCIWNDM_SENDSTRING, 0, (LPARAM)(LPSTR)(sz))
  157. #define MCIWndReturnString(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_RETURNSTRING, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  158. #define MCIWndGetError(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETERROR, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  159. //#define MCIWndActivate(hwnd, f) (void)MCIWndSM(hwnd, WM_ACTIVATE, (WPARAM)(BOOL)(f), 0)
  160. #define MCIWndGetPalette(hwnd) (HPALETTE)MCIWndSM(hwnd, MCIWNDM_GETPALETTE, 0, 0)
  161. #define MCIWndSetPalette(hwnd, hpal) (LONG)MCIWndSM(hwnd, MCIWNDM_SETPALETTE, (WPARAM)(HPALETTE)(hpal), 0)
  162. #define MCIWndGetFileName(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETFILENAME, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  163. #define MCIWndGetDevice(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETDEVICE, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  164. #define MCIWndGetStyles(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETSTYLES, 0, 0L)
  165. #define MCIWndChangeStyles(hwnd, mask, value) (LONG)MCIWndSM(hwnd, MCIWNDM_CHANGESTYLES, (WPARAM)(UINT)(mask), (LPARAM)(LONG)(value))
  166. #define MCIWndOpenInterface(hwnd, pUnk) (LONG)MCIWndSM(hwnd, MCIWNDM_OPENINTERFACE, 0, (LPARAM)(LPUNKNOWN)(pUnk))
  167. #define MCIWndSetOwner(hwnd, hwndP) (LONG)MCIWndSM(hwnd, MCIWNDM_SETOWNER, (WPARAM)(hwndP), 0)
  168. // Messages an app will send to MCIWND
  169. #define MCIWNDM_GETDEVICEID (WM_USER + 100)
  170. #define MCIWNDM_SENDSTRING (WM_USER + 101)
  171. #define MCIWNDM_GETPOSITION (WM_USER + 102)
  172. #define MCIWNDM_GETSTART (WM_USER + 103)
  173. #define MCIWNDM_GETLENGTH (WM_USER + 104)
  174. #define MCIWNDM_GETEND (WM_USER + 105)
  175. #define MCIWNDM_GETMODE (WM_USER + 106)
  176. #define MCIWNDM_EJECT (WM_USER + 107)
  177. #define MCIWNDM_SETZOOM (WM_USER + 108)
  178. #define MCIWNDM_GETZOOM (WM_USER + 109)
  179. #define MCIWNDM_SETVOLUME (WM_USER + 110)
  180. #define MCIWNDM_GETVOLUME (WM_USER + 111)
  181. #define MCIWNDM_SETSPEED (WM_USER + 112)
  182. #define MCIWNDM_GETSPEED (WM_USER + 113)
  183. #define MCIWNDM_SETREPEAT (WM_USER + 114)
  184. #define MCIWNDM_GETREPEAT (WM_USER + 115)
  185. #define MCIWNDM_REALIZE (WM_USER + 118)
  186. #define MCIWNDM_SETTIMEFORMAT (WM_USER + 119)
  187. #define MCIWNDM_GETTIMEFORMAT (WM_USER + 120)
  188. #define MCIWNDM_VALIDATEMEDIA (WM_USER + 121)
  189. #define MCIWNDM_PLAYFROM (WM_USER + 122)
  190. #define MCIWNDM_PLAYTO (WM_USER + 123)
  191. #define MCIWNDM_GETFILENAME (WM_USER + 124)
  192. #define MCIWNDM_GETDEVICE (WM_USER + 125)
  193. #define MCIWNDM_GETPALETTE (WM_USER + 126)
  194. #define MCIWNDM_SETPALETTE (WM_USER + 127)
  195. #define MCIWNDM_GETERROR (WM_USER + 128)
  196. #define MCIWNDM_SETTIMERS (WM_USER + 129)
  197. #define MCIWNDM_SETACTIVETIMER (WM_USER + 130)
  198. #define MCIWNDM_SETINACTIVETIMER (WM_USER + 131)
  199. #define MCIWNDM_GETACTIVETIMER (WM_USER + 132)
  200. #define MCIWNDM_GETINACTIVETIMER (WM_USER + 133)
  201. #define MCIWNDM_NEW (WM_USER + 134)
  202. #define MCIWNDM_CHANGESTYLES (WM_USER + 135)
  203. #define MCIWNDM_GETSTYLES (WM_USER + 136)
  204. #define MCIWNDM_GETALIAS (WM_USER + 137)
  205. #define MCIWNDM_RETURNSTRING (WM_USER + 138)
  206. #define MCIWNDM_PLAYREVERSE (WM_USER + 139)
  207. #define MCIWNDM_GET_SOURCE (WM_USER + 140)
  208. #define MCIWNDM_PUT_SOURCE (WM_USER + 141)
  209. #define MCIWNDM_GET_DEST (WM_USER + 142)
  210. #define MCIWNDM_PUT_DEST (WM_USER + 143)
  211. #define MCIWNDM_CAN_PLAY (WM_USER + 144)
  212. #define MCIWNDM_CAN_WINDOW (WM_USER + 145)
  213. #define MCIWNDM_CAN_RECORD (WM_USER + 146)
  214. #define MCIWNDM_CAN_SAVE (WM_USER + 147)
  215. #define MCIWNDM_CAN_EJECT (WM_USER + 148)
  216. #define MCIWNDM_CAN_CONFIG (WM_USER + 149)
  217. #define MCIWNDM_PALETTEKICK (WM_USER + 150)
  218. #define MCIWNDM_OPENINTERFACE (WM_USER + 151)
  219. #define MCIWNDM_SETOWNER (WM_USER + 152)
  220. // Messages MCIWND will send to an app
  221. // !!! Use less messages and use a code instead to indicate the type of notify?
  222. #define MCIWNDM_NOTIFYMODE (WM_USER + 200) // wp = hwnd, lp = mode
  223. #define MCIWNDM_NOTIFYPOS (WM_USER + 201) // wp = hwnd, lp = pos
  224. #define MCIWNDM_NOTIFYSIZE (WM_USER + 202) // wp = hwnd
  225. #define MCIWNDM_NOTIFYMEDIA (WM_USER + 203) // wp = hwnd, lp = fn
  226. #define MCIWNDM_NOTIFYERROR (WM_USER + 205) // wp = hwnd, lp = error
  227. // special seek values for START and END
  228. #define MCIWND_START -1
  229. #define MCIWND_END -2
  230. #ifndef MCI_PLAY
  231. /* MCI command message identifiers */
  232. #define MCI_OPEN 0x0803
  233. #define MCI_CLOSE 0x0804
  234. #define MCI_PLAY 0x0806
  235. #define MCI_SEEK 0x0807
  236. #define MCI_STOP 0x0808
  237. #define MCI_PAUSE 0x0809
  238. #define MCI_STEP 0x080E
  239. #define MCI_RECORD 0x080F
  240. #define MCI_SAVE 0x0813
  241. #define MCI_CUT 0x0851
  242. #define MCI_COPY 0x0852
  243. #define MCI_PASTE 0x0853
  244. #define MCI_RESUME 0x0855
  245. #define MCI_DELETE 0x0856
  246. #endif
  247. #ifndef MCI_MODE_NOT_READY
  248. /* return values for 'status mode' command */
  249. #define MCI_MODE_NOT_READY (524)
  250. #define MCI_MODE_STOP (525)
  251. #define MCI_MODE_PLAY (526)
  252. #define MCI_MODE_RECORD (527)
  253. #define MCI_MODE_SEEK (528)
  254. #define MCI_MODE_PAUSE (529)
  255. #define MCI_MODE_OPEN (530)
  256. #endif
  257. #ifdef __cplusplus
  258. }
  259. #endif
  260. #endif