16 static const tchar winmmStr[] =
_T(
"WINMM.DLL");
18 static const char mciSendCommandStr[] =
"mciSendCommandW";
20 static const char mciSendCommandStr[] =
"mciSendCommandA";
29 static TModule winmmModule(winmmStr,
true,
true,
false);
39 static TModuleProc4<MCIERROR, MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR>
40 mci_SendCommand(
GetModule(), mciSendCommandStr);
41 return mci_SendCommand(deviceId, msg, flags, param);
57 TWindow(
nullptr,
nullptr, module),
60 Attr.Style = WS_POPUP;
69 TResult retVal = Mci.MciNotify(wp, lp);
80 WaitingForNotification(false)
105 return Window->GetHandle();
116 return MCI_NOTIFY_ABORTED;
127 MCIERROR retVal =
SendCommand(0, MCI_OPEN, flags,
reinterpret_cast<DWORD_PTR
>(&parms));
131 DeviceId = parms.wDeviceID;
154 MCI_GENERIC_PARMS parms;
156 if (flags & MCI_NOTIFY)
159 MCIERROR retVal =
SendCommand(MCI_STOP, flags,
reinterpret_cast<DWORD_PTR
>(&parms));
160 SetBusyIfNeeded(flags);
171 MCI_GENERIC_PARMS parms;
173 if (flags & MCI_NOTIFY)
176 MCIERROR retVal =
SendCommand(MCI_PAUSE, flags,
reinterpret_cast<DWORD_PTR
>(&parms));
177 SetBusyIfNeeded(flags);
188 MCI_GENERIC_PARMS parms;
190 if (flags & MCI_NOTIFY)
193 MCIERROR retVal =
SendCommand(MCI_RESUME, flags,
reinterpret_cast<DWORD_PTR
>(&parms));
194 SetBusyIfNeeded(flags);
202TMci::SetBusyIfNeeded(DWORD_PTR flags)
204 if (flags & MCI_NOTIFY)
214 MCIERROR retVal =
SendCommand(MCI_PLAY, flags,
reinterpret_cast<DWORD_PTR
>(&parms));
215 SetBusyIfNeeded(flags);
226 MCIERROR retVal =
SendCommand(MCI_SEEK, flags,
reinterpret_cast<DWORD_PTR
>(&parms));
227 SetBusyIfNeeded(flags);
238 MCI_SEEK_PARMS parms;
240 if (flags & MCI_NOTIFY)
245 return Seek(parms, flags);
254 MCI_LOAD_PARMS parms;
256 flags |= MCI_LOAD_FILE;
258 if (flags & MCI_NOTIFY)
260 parms.lpfilename = fileName.c_str();
261 return SendCommand(MCI_LOAD, flags,
reinterpret_cast<DWORD_PTR
>(&parms));
A private TWindow derivative used by TMci to capture events.
TMciHiddenWindow(TMci &, TModule *=0)
A hidden window created for the sole purpose of catching MCI messages.
TResult EvMciNotify(TParam1, TParam2)
Notifies the MCI class that the MCI event has finished.
TMci is a Windows MCI (Media Control Interface) encapsulation class.
MCIERROR Play(const MCI_PLAY_PARMS &, DWORD_PTR flags=0)
Plays the MCI device.
MCIDEVICEID GetDeviceId() const
Returns the ID of the open MCI device.
TMci()
Creates a hidden window for catching messages.
virtual ~TMci()
If the MCI device is still open, this closes it now. Deletes the hidden window.
MCIERROR Close()
Stops the MCI device and closes it.
void SetBusy(bool)
Sets the busy flag for the MCI device.
HWND GetCallbackWindow() const
Returns the callback. If the window exists, the handle of the window is returned.
MCIERROR Open(const MCI_OPEN_PARMS &, DWORD_PTR flags=0)
Opens the MCI device.
MCIERROR Load(const tstring &fileName, DWORD_PTR flags=0)
Loads the file into the MCI device.
MCIERROR SendCommand(UINT msg, DWORD_PTR flags, DWORD_PTR param)
Sends the MCI command message to the device if it's not busy.
bool IsBusy() const
Returns true if the MCI is currently busy doing something.
MCIERROR Resume(DWORD_PTR flags=0)
Resumes playing of the MCI device.
MCIERROR Pause(DWORD_PTR flags=0)
Pauses the MCI device.
MCIERROR Seek(const MCI_SEEK_PARMS &, DWORD_PTR flags=0)
Seeks a particular position on the MCI device.
virtual TResult MciNotify(TParam1, TParam2)
The default MciNotify is to return 0.
MCIERROR Stop(DWORD_PTR flags=0)
Stops the MCI device.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
static TModule & GetModule()
static MCIERROR mciSendCommand(MCIDEVICEID, UINT msg, DWORD_PTR flags, DWORD_PTR param)
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
TWindow(TWindow *parent, LPCTSTR title=nullptr, TModule *module=nullptr)
Adds this to the child list of parent if nonzero, and calls EnableAutoCreate so that this will be cre...
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Windows MCI (Media Control Interface) encapsulation classes.
Object Windows Library (OWLNext Core).
LPARAM TParam2
Second parameter type.
WPARAM TParam1
First parameter type.
LRESULT TResult
Result type.
EV_MESSAGE(BM_SETSTYLE, BMSetStyle)