i am just learning C++ again after about 5 years of not learning it so i decided to use Visual C++ but learning is a bit hard at the moment, understanding everything and llearning to use everything

anyway i need help or need to know why this code won't work in a consol app also mmsystem.h gives me a error when compliling an consol app

Also is visual C++ 2008 a good idea ?

#include <mmsystem.h>

int main()
{
    mciSendString("Set cdaudio door open", 0, 0, 0);
    mciSendString("Set cdaudio door close",0,0,0);
    return 0;
}

Thank you for your help

Edited 6 Years Ago by chrisdod: n/a

Well, Visual C++ 2008 is not a bad idea. Provided you know what you are doing.
What learning material are you using in the first place?
And where did you get the code for that program?
This link makes it clear that it is not an entry level program.


The reason your program won't compile, is because it is not a normal console application.
Best thing for you would be to find an entry level tutorial for VC2008 and start from there. Or use this tutorial. You will have to replace VC2008 with Code::blocks.

add #include <windows.h> before mmsystem.h

you may need to turn off UNICODE -- select menu item Projects --> Properties (the last menu item), expand the Configuration Properties tab, select General, then on the right side of the screen, third item from the bottom, change Character Set option to Not Set.

Edited 6 Years Ago by Ancient Dragon: n/a

This article has been dead for over six months. Start a new discussion instead.