Click here to Skip to main content
16,008,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WM_SIZE & WM_MOVE only sent by DefWindowProc (...) ?? Pin
15-Feb-02 11:45
suss15-Feb-02 11:45 
Generalproblem with mmsystem.h Pin
starn15-Feb-02 7:10
starn15-Feb-02 7:10 
GeneralRe: problem with mmsystem.h Pin
Joaquín M López Muñoz15-Feb-02 7:13
Joaquín M López Muñoz15-Feb-02 7:13 
GeneralRe: problem with mmsystem.h Pin
starn15-Feb-02 7:39
starn15-Feb-02 7:39 
GeneralRe: problem with mmsystem.h Pin
Joaquín M López Muñoz15-Feb-02 7:45
Joaquín M López Muñoz15-Feb-02 7:45 
GeneralRe: problem with mmsystem.h Pin
starn15-Feb-02 7:56
starn15-Feb-02 7:56 
GeneralRe: problem with mmsystem.h Pin
Joaquín M López Muñoz15-Feb-02 8:00
Joaquín M López Muñoz15-Feb-02 8:00 
GeneralRe: problem with mmsystem.h Pin
starn15-Feb-02 8:09
starn15-Feb-02 8:09 
Sorry but I don't know which part of the code I have to give you so I prefer to give you the all thing...
SORRY FOR THE INCONVENIENCE


#include "stdafx.h"
#include "mci.h"

//////////////////////////////////////////////////////////////////////////
// CMciDevice implementation
//

// Common Modes
const DWORD CMciDevice::ModeNotReady = MCI_MODE_NOT_READY;
const DWORD CMciDevice::ModePause = MCI_MODE_PAUSE;
const DWORD CMciDevice::ModePlay = MCI_MODE_PLAY;
const DWORD CMciDevice::ModeStop = MCI_MODE_STOP;
const DWORD CMciDevice::ModeOpen = MCI_MODE_OPEN;
const DWORD CMciDevice::ModeRecord = MCI_MODE_RECORD;
const DWORD CMciDevice::ModeSeek = MCI_MODE_SEEK;
// Common status
const DWORD CMciDevice::StatusReady = MCI_STATUS_READY;
const DWORD CMciDevice::StatusMediaPresent = MCI_STATUS_MEDIA_PRESENT;
const DWORD CMciDevice::StatusMode = MCI_STATUS_MODE;
const DWORD CMciDevice::StatusNumberOfTracks = MCI_STATUS_NUMBER_OF_TRACKS;
// Common capabilites
const DWORD CMciDevice::GetdevcapsCanEject = MCI_GETDEVCAPS_CAN_EJECT;
const DWORD CMciDevice::GetdevcapsCanPlay = MCI_GETDEVCAPS_CAN_PLAY;
const DWORD CMciDevice::GetdevcapsCanRecord = MCI_GETDEVCAPS_CAN_RECORD;
const DWORD CMciDevice::GetdevcapsCanSave = MCI_GETDEVCAPS_CAN_SAVE;
const DWORD CMciDevice::GetdevcapsCompound = MCI_GETDEVCAPS_COMPOUND_DEVICE;
const DWORD CMciDevice::GetdevcapsDeviceType = MCI_GETDEVCAPS_DEVICE_TYPE;
const DWORD CMciDevice::GetdevcapsHasAudio = MCI_GETDEVCAPS_HAS_AUDIO;
const DWORD CMciDevice::GetdevcapsHasVideo = MCI_GETDEVCAPS_HAS_VIDEO;
const DWORD CMciDevice::GetdevcapsUsesFiles = MCI_GETDEVCAPS_USES_FILES;

const DWORD CMciDevice::InfoProduct = MCI_INFO_PRODUCT;

const DWORD CMciDevice::DevtypeAnimation = MCI_DEVTYPE_ANIMATION;
const DWORD CMciDevice::DevtypeCdaudio = MCI_DEVTYPE_CD_AUDIO;
const DWORD CMciDevice::DevtypeDat = MCI_DEVTYPE_DAT;
const DWORD CMciDevice::DevtypeDigitalvideo = MCI_DEVTYPE_DIGITAL_VIDEO;
const DWORD CMciDevice::DevtypeOther = MCI_DEVTYPE_OTHER;
const DWORD CMciDevice::DevtypeOverlay = MCI_DEVTYPE_OVERLAY;
const DWORD CMciDevice::DevtypeScanner = MCI_DEVTYPE_SCANNER;
const DWORD CMciDevice::DevtypeSequencer = MCI_DEVTYPE_SEQUENCER;
const DWORD CMciDevice::DevtypeVcr = MCI_DEVTYPE_VCR;
const DWORD CMciDevice::DevtypeVideodisc = MCI_DEVTYPE_VIDEODISC;
const DWORD CMciDevice::DevtypeWaveaudio = MCI_DEVTYPE_WAVEFORM_AUDIO;

CMciDevice::CMciDevice() {
m_wDeviceID = NULL;
m_hMainWnd = NULL;
m_bReportErrors = FALSE;
}

CMciDevice::~CMciDevice() {
}

// Open by device name (obtained by the registry or system.ini)
DWORD CMciDevice::Open(LPCSTR lpstrName, BOOL bShareable /*=FALSE*/)
{
ASSERT(lpstrName != NULL);

DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;

// Open a device by specifying the device name.
mciOpenParms.lpstrDeviceType = lpstrName;

DWORD dwFlags = MCI_OPEN_TYPE|MCI_WAIT;
if (bShareable) dwFlags |= MCI_OPEN_SHAREABLE;

dwReturn = SendCommand(MCI_OPEN, dwFlags, (DWORD)(LPVOID) &mciOpenParms);

if (dwReturn == 0) {
// The device opened successfully; get the device ID.
m_wDeviceID = mciOpenParms.wDeviceID;
}

return dwReturn;
}

// Open by device type
DWORD CMciDevice::Open(DWORD dwDeviceType, BOOL bShareable /*=FALSE*/)
{
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;

// Opens a device by specifying a device-type constant.
mciOpenParms.lpstrDeviceType = (LPCSTR) dwDeviceType;

DWORD dwFlags = MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID|MCI_WAIT;
if (bShareable) dwFlags |= MCI_OPEN_SHAREABLE;

dwReturn = SendCommand(MCI_OPEN, dwFlags,
(DWORD)(LPVOID) &mciOpenParms);

if (dwReturn == 0) {
// The device opened successfully; get the device ID.
m_wDeviceID = mciOpenParms.wDeviceID;
}

return dwReturn;
}

// Closes the device
DWORD CMciDevice::Close() {
MCI_GENERIC_PARMS mciGenericParms;
mciGenericParms.dwCallback = (DWORD) m_hMainWnd;
return SendCommand(MCI_CLOSE, 0, (DWORD) &mciGenericParms);
}

// Gets the current callback window
HWND CMciDevice::GetCallbackHwnd() const {
return m_hMainWnd;
}

// Set the current callback window
void CMciDevice::SetCallbackWnd(CWnd *pWnd) {
ASSERT(pWnd != NULL);
m_hMainWnd = pWnd->GetSafeHwnd();
}

// Set the current callback window
void CMciDevice::SetCallbackWnd(HWND hWnd) {
ASSERT(hWnd != NULL);
m_hMainWnd = hWnd;
}

// Attaches the MCI device to a device already opened
void CMciDevice::Attach(UINT wDeviceID) {
m_wDeviceID = wDeviceID;
}

// Gets the device ID
MCIDEVICEID CMciDevice::GetDeviceID() const {
return m_wDeviceID;
}

// mciSendCommand with error handling
DWORD CMciDevice::SendCommand(UINT uMsg, DWORD fdwCommand, DWORD dwParam) {
DWORD dwReturn;
if (dwReturn = mciSendCommand(m_wDeviceID, uMsg, fdwCommand, dwParam)) {
m_dwLastError = dwReturn;
if (m_bReportErrors)
ShowError(dwReturn);
}
return dwReturn;
}

MCIERROR CMciDevice::GetLastError() const {
return m_dwLastError;
}

// Generic MCI_GETDEVCAPS_ITEM command: good for all devices
DWORD CMciDevice::GetDevCaps(DWORD dwDevcaps, BOOL bItem /*=FALSE*/) {
MCI_GETDEVCAPS_PARMS mciCapsParms;

mciCapsParms.dwCallback = (DWORD) m_hMainWnd;
mciCapsParms.dwReturn = 0;

if (bItem) {
mciCapsParms.dwItem = dwDevcaps;
dwDevcaps |= MCI_GETDEVCAPS_ITEM;
}

SendCommand(MCI_GETDEVCAPS, dwDevcaps, (DWORD) &mciCapsParms);

return mciCapsParms.dwReturn;
}

// Generic MCI_INFO command
DWORD CMciDevice::GetInfo(DWORD dwInfo, LPSTR lpstrReturn, DWORD dwRetSize) {
MCI_INFO_PARMS mciInfoParms;

mciInfoParms.dwCallback = (DWORD) m_hMainWnd;
mciInfoParms.lpstrReturn = lpstrReturn;
mciInfoParms.dwRetSize = dwRetSize;

return SendCommand(MCI_INFO, dwInfo, (DWORD) &mciInfoParms);
}

// Set error report on/off
void CMciDevice::ReportErrors(BOOL bReport /*=TRUE*/) {
m_bReportErrors = bReport;
}

// Uses mciGetErrorString to get a textual description of an MCI error.
// Displays the error description using MessageBox.
void CMciDevice::ShowError(DWORD dwError)
{
char szErrorBuf[MAXERRORLENGTH];
MessageBeep(MB_ICONEXCLAMATION);

CWnd* pMainWnd = AfxGetApp()->m_pMainWnd;
ASSERT(pMainWnd != NULL);
HWND hMainWnd = pMainWnd->GetSafeHwnd();

if(mciGetErrorString(dwError, (LPSTR) szErrorBuf, MAXERRORLENGTH)) {
MessageBox(hMainWnd, szErrorBuf, _T("MCI Error"),
MB_ICONEXCLAMATION);
}
else
MessageBox(hMainWnd, _T("Unknown Error"), _T("MCI Error"),
MB_ICONEXCLAMATION);
}

// Closes all MCI devices opened by the application.
// Waits until devices are closed before returning.
DWORD CMciDevice::CloseAll()
{
DWORD dwReturn;

if (dwReturn = mciSendCommand(MCI_ALL_DEVICE_ID, MCI_CLOSE, MCI_WAIT, NULL))
ShowError(dwReturn);
return dwReturn;
}

DWORD CMciDevice::GetMode() {
return GetStatus(StatusMode);
}

// Generic MCI_STATUS command
DWORD CMciDevice::GetStatus(DWORD dwItem) {
MCI_STATUS_PARMS mciStatusParms;
mciStatusParms.dwCallback = (DWORD) m_hMainWnd;
mciStatusParms.dwItem = dwItem;
mciStatusParms.dwReturn = 0;

SendCommand(MCI_STATUS, MCI_STATUS_ITEM, (DWORD) &mciStatusParms);

return mciStatusParms.dwReturn;
}

GeneralRe: problem with mmsystem.h Pin
Joaquín M López Muñoz15-Feb-02 9:25
Joaquín M López Muñoz15-Feb-02 9:25 
GeneralRe: problem with mmsystem.h Pin
starn15-Feb-02 9:45
starn15-Feb-02 9:45 
GeneralI found it! Pin
Joaquín M López Muñoz15-Feb-02 10:11
Joaquín M López Muñoz15-Feb-02 10:11 
GeneralRe: I found it! Pin
starn16-Feb-02 4:32
starn16-Feb-02 4:32 
GeneralRe: I found it! Pin
Joaquín M López Muñoz16-Feb-02 5:05
Joaquín M López Muñoz16-Feb-02 5:05 
GeneralRe: I found it! Pin
starn16-Feb-02 5:37
starn16-Feb-02 5:37 
GeneralRe: I found it! Pin
Joaquín M López Muñoz16-Feb-02 6:04
Joaquín M López Muñoz16-Feb-02 6:04 
GeneralRe: I found it! Pin
starn16-Feb-02 6:14
starn16-Feb-02 6:14 
Generalreading files Pin
RK_200015-Feb-02 6:42
RK_200015-Feb-02 6:42 
GeneralRe: reading files Pin
Nish Nishant15-Feb-02 6:52
sitebuilderNish Nishant15-Feb-02 6:52 
GeneralRe: reading files Pin
alex.barylski15-Feb-02 6:52
alex.barylski15-Feb-02 6:52 
GeneralRe: reading files Pin
Joaquín M López Muñoz15-Feb-02 6:54
Joaquín M López Muñoz15-Feb-02 6:54 
GeneralRe: reading files Pin
alex.barylski15-Feb-02 7:09
alex.barylski15-Feb-02 7:09 
GeneralRe: reading files Pin
Nish Nishant15-Feb-02 8:16
sitebuilderNish Nishant15-Feb-02 8:16 
GeneralRe: reading files Pin
Joaquín M López Muñoz15-Feb-02 9:20
Joaquín M López Muñoz15-Feb-02 9:20 
GeneralRe: reading files Pin
alex.barylski15-Feb-02 6:52
alex.barylski15-Feb-02 6:52 
GeneralRe: reading files Pin
Joaquín M López Muñoz15-Feb-02 6:51
Joaquín M López Muñoz15-Feb-02 6:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.