title: Playing mp3 file with winmm.dll in C# works well in GUI app, but does not work in cosnsole app
body: <p>So, I am trying to play mp3 file in C# console application.</p>
  
  <pre><code>class Program
  {
      [DllImport("winmm.dll")]
      static extern Int32 mciSendString(string command,
          StringBuilder buffer, int bufferSize, IntPtr hwndCallback);
      static void Main(string[] args)
      {
          string filePath = "1.mp3";
          string command = "open \"" + filePath + "\" type mpegvideo alias MyTag";
          Int32 err = mciSendString(command, null, 0, IntPtr.Zero);
          command = "play MyTag";
          err = mciSendString(command, null, 0, IntPtr.Zero);
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>But I'm getting error 266 (<code>MCIERR_CANNOT_LOAD_DRIVER</code>) when try to open file. Intersting thing is that the same code works well if I put it into button callback of GUI app (Windows Forms Application). Also it works if I change code ommitting file open.</p>
  
  <pre><code>string filePath = "1.mp3";
  string command = "play " + filePath;
  Int32 err = mciSendString(command, null, 0, IntPtr.Zero);
  </code></pre>
  
  <p>It also works well but I'd like to separate open action.</p>
  
  <p>I'm using Microsoft Visual Studio 2008, .NET 3.5 (tested also on .NET 2.0 with the same results), Windows 7 32-bit.</p>
  
  <p>Any ideas why is it so?</p>