title: MCISendCommand Can't find file, but Fstream can so I know it exists, why?
body: <p>I'm trying to play a midi file using MCISendCommand but I keep getting a DWORD error code 275 (File Not found). I have since placed the relevant code inside a fstream open call which DOES find the file. I then close the file to allow the MCISendCommand code to access it but it still cannot find the file. </p>
  
  <p>Here is the relevant code:</p>
  
  <pre><code>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)&amp;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;
    }
  }
  </code></pre>
  
  <p>I should also mention that this code works in a sample project from a textbook of mine "Beginning Game Programming" by Michael Morrison. As far as I can tell all project properties are identical. For some reason, however, the code does not work for me in my own project, even though I have since copy/pasted every single line of code over from the sample project (there is not that much, 3/5 small classes). </p>