MCISendCommand를 사용하여 MIDI 파일을 재생하려고하는데 DWORD 오류 코드 275 (파일을 찾을 수 없음)가 계속 표시됩니다. 나는 이후 파일을 찾는 fstream open 호출 안에 관련 코드를 배치했다. 그런 다음 MCISendCommand 코드에 액세스 할 수 있도록 파일을 닫지 만 여전히 파일을 찾을 수 없습니다.MCISendCommand 파일을 찾을 수 없지만 Fstream이 파일을 찾을 수 있으므로 그 이유는 무엇입니까?
fstream f;
f.open(szMIDIFileName);
if(f.is_open())
// Then the file exists
{
f.close();
// See if the MIDI player needs to be opened
if (m_uiMIDIPlayerID == 0)
{
// Open the MIDI player by specifying the device and filename
MCI_OPEN_PARMS mciOpenParms;
mciOpenParms.lpstrDeviceType = "sequencer";
mciOpenParms.lpstrElementName = szMIDIFileName; //The name of the file passed in as a param
if (mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT,
(DWORD_PTR)&mciOpenParms) == 0)
// Get the ID for the MIDI player
m_uiMIDIPlayerID = mciOpenParms.wDeviceID;
else
// There was a problem, so just return
// This is where I keep ending up in my code with DWORD error 275
return;
}
}
나는 또한이 코드는 마이클 모리슨 "게임 프로그래밍을 시작으로"내 교과서에서 샘플 프로젝트에서 작동하는지 언급해야한다 :
여기에 관련 코드입니다. 내가 아는 한 모든 프로젝트 속성은 동일합니다. 그러나 몇 가지 이유로, 샘플 프로젝트에서 코드의 모든 단일 행을 복사/붙여 넣기 했어도 (그다지 3/5 개의 작은 클래스는 없습니다.), 자신의 프로젝트에서이 코드가 제게 적합하지 않습니다.