home *** CD-ROM | disk | FTP | other *** search
/ The Best of Windows 95.com 1996 September / WIN95_09964.iso / sound / mpw32-5s.zip / MCIPLAY.CPP < prev    next >
C/C++ Source or Header  |  1996-07-20  |  2KB  |  109 lines

  1. #define STRICT
  2. #define WIN32_LEAN_AND_MEAN
  3. #define NOMCX
  4. #define NOIME
  5. // #define NOGDI             GDI APIs and definitions
  6. // #define NOUSER            USER APIs and definitions
  7. #define NOSOUND
  8. #define NOCOMM
  9. #define NODRIVERS
  10. #define OEMRESOURCE
  11. #define NONLS
  12. #define NOSERVICE
  13. #define NOKANJI
  14. #define NOMINMAX
  15. #define NOLOGERROR
  16. #define NOPROFILER
  17. #define NOMEMMGR
  18. #define NOLFILEIO
  19. #define NOOPENFILE
  20. #define NORESOURCE
  21. #define NOATOM
  22. #define NOLANGUAGE
  23. #define NOLSTRING
  24. #define NODBCS
  25. #define NOKEYBOARDINFO
  26. #define NOGDICAPMASKS
  27. #define NOCOLOR
  28. #define NOGDIOBJ
  29. #define NODRAWTEXT
  30. #define NOTEXTMETRIC
  31. #define NOSCALABLEFONT
  32. #define NOBITMAP
  33. #define NORASTEROPS
  34. #define NOMETAFILE
  35. #define NOSYSMETRICS
  36. #define NOSYSTEMPARAMSINFO
  37. #define NOMSG
  38. #define NOWINSTYLES
  39. #define NOWINOFFSETS
  40. #define NOSHOWWINDOW
  41. #define NODEFERWINDOWPOS
  42. #define NOVIRTUALKEYCODES
  43. #define NOKEYSTATES
  44. #define NOWH
  45. #define NOMENUS
  46. #define NOSCROLL
  47. #define NOCLIPBOARD
  48. #define NOICONS
  49. #define NOMB
  50. #define NOSYSCOMMANDS
  51. #define NOMDI
  52. #define NOCTLMGR
  53. #define NOWINMESSAGES
  54. #define NOHELP
  55. // #define _WINUSER_
  56. #define __oleidl_h__
  57. #define _OLE2_H_
  58. #include <windows.h>
  59.  
  60. #define MMNODRV
  61. #define MMNOSOUND
  62. // #define MMNOWAVE
  63. #define MMNOMIDI
  64. #define MMNOAUX
  65. #define MMNOTIMER
  66. #define MMNOJOY
  67. //#define MMNOMCI
  68. #define MMNOMMIO
  69. #define MMNOMMSYSTEM
  70. #include <mmsystem.h>
  71.  
  72. #include <stdlib.h>
  73. #include "args.h"
  74. #include "mp2win.h"
  75.  
  76. DWORD mciplay (MCI_Args *args)
  77. {
  78.     char mci_buffer[1024];
  79.     char mci_command[1024];
  80.     char ms_buffer[32];
  81.  
  82.     while(TRUE) {
  83.  
  84.         // Handle seeks
  85.         if (args->position_change) {
  86.             mciSendString("stop sounder", mci_buffer, 1024, NULL);
  87.             lstrcpy(mci_command, "seek sounder to ");
  88.             lstrcat(mci_command, itoa(args->desired_position, ms_buffer, 10));
  89.             lstrcat(mci_command, " wait");
  90.             mciSendString(mci_command, mci_buffer, 1024, NULL);
  91.  
  92.             if (args->playing)
  93.                 mciSendString("play sounder notify", mci_buffer, 1024, args->hWnd);
  94.  
  95.             args->position_change = FALSE;
  96.  
  97.             SendMessage(args->hWnd, SEEK_ACK, 0, 0);
  98.  
  99.         } else
  100.             Sleep(500);
  101.  
  102.       // Update the scroll bar
  103.         mciSendString("status sounder position", mci_buffer, 1024, NULL);
  104.         SendMessage(args->hWnd, SCROLL_POS, atoi(mci_buffer), 0);
  105.     }
  106. }
  107.  
  108.  
  109.