The following code illustrates how to set periodic position-change messages from a media device.

/* Request position advise notification every 2 seconds             */

USHORT usDeviceID;
HWND hwndMyWindow;
MCI_POSITION_PARMS positionparms; /* Position advise parm structure */

/* Assign hwndCallback the handle to the PM Window - this is where
   MM_MCIPOSITIONCHANGE messages will be received.                  */

positionparms.hwndCallback = hwndMyWindow;
positionparms.ulUnits = (ULONG) 2000; /* (Current time format = MS) */

mciSendCommand(usDeviceID,            /* Device ID                  */
 MCI_SET_POSITION_ADVISE,             /* MCI set position advise
                                         message                    */
 MCI_SET_POSITION_ADVISE_ON | MCI_WAIT,
                                      /* Flags for this message     */
 (PVOID) &positionparms,              /* Data structure             */
 0);                                  /* No user parm               */


[Back] [Next]