You can do the same thing using sample numbers.
Here is the modified code, without error checking:
**************************************************
#include <windows.h>
#include <mmsystem.h>
// Open a Wave Audio device, associating it with a wav file, and wait for the operation to complete
mciSendString("open \"c:\\windows\\media\\Windows XP Startup.wav\" alias mysound wait", 0, 0, 0);
// Set the time format to samples (note: default format is milliseconds)
mciSendString("set mysound time format samples", 0, 0, 0);
// Play the selected part of the waveform and wait for this operation to complete
// (if the sample rate is 22000, this will play from 1000 to 3000 ms)
mciSendString("play mysound from 22000 to 66000 wait", 0, 0, 0);
// Close the device, and wait for this operation to complete
mciSendString("close mysound wait", 0, 0, 0);
**************************************************
(I found the information
here)
Regards,
Colin.