dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Using MCI with an audio CD

  1. #1
    Join Date
    Feb 2012
    Posts
    7

    Using MCI with an audio CD

    Hi, I am trying to write an interface to my Sony 300 disk CD player. I've just about got everything done except for adding a CD to my database. To make this task easier I was hoping to use MCI to gain info such as number of tracks and time of each track. But I am having difficulty getting MCI to do anything. I was wondering if MCI is still supported on Vista? And/Or is their a better (easier to use) API for my needs? If MCI is a good API for my needs and if it supported in Vista could someone maybe tell me why my simple little MCI test program is not working? TIA, here is my code and I am using VC 2008 express.

    // simpleMciTest.cpp : Defines the entry point for the console application.
    //

    #include "stdafx.h"
    #include "windows.h"


    int _tmain(int argc, _TCHAR* argv[])
    {
    //load audio and (in short) name it 'myFile'
    //[DllImport("winmm.dll")]
    int *response=NULL;
    int err=0;
    err = mciSendString(L"open song.mp3 type mpegvideo alias myFile", (LPWSTR) response, 128, 0);


    //play audio
    err = mciSendString(L"play myFile", (LPWSTR) response, 128, 0);


    //close all
    err = mciSendString(L"close myFile", (LPWSTR) response, 128, 0);

    return 0;

    }



    First err is 0 when song.mp3 exists. err is 275 when song.mp3 does not exist so I think the program is working but song.mp3 is not played and the program executes quickly leading me to believe no attempt is made to play the song.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,581

    Re: Using MCI with an audio CD

    Quote Originally Posted by jpsb View Post
    I was wondering if MCI is still supported on Vista? And/Or is their a better (easier to use) API for my needs? If MCI is a good API for my needs and if it supported in Vista could someone maybe tell me why my simple little MCI test program is not working? TIA, here is my code and I am using VC 2008 express.
    just look at MSDN article mciSendString function to find out (or not) possible restrictions.

    Quote Originally Posted by jpsb View Post
    First err is 0 when song.mp3 exists. err is 275 when song.mp3 does not exist so I think the program is working but song.mp3 is not played and the program executes quickly leading me to believe no attempt is made to play the song.
    If error is not zero - call mciGetErrorString to get extended error info.
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)