prototype for mciSendString,sleep,beep

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nagarajr
    New Member
    • Nov 2010
    • 1

    #1

    prototype for mciSendString,sleep,beep

    prototype for mciSendString,s leep,beep. unable to open include windows.h,mmsys tem.h error. is this syntax correct using namespace std;


    #include <iostream>
    #include <windows.h> // Sleep()
    #include <mmsystem.h> // mciSendString()

    using namespace std; // std::cout, std::cin

    int main()
    {
    mciSendString(" open CDAudio", NULL, 0, NULL);
    Beep(440,1000);
    cout << "Opening CD-ROM door ..." << endl;
    mciSendString(" set CDAudio door open", NULL, 0, NULL);

    cout << "Closing the CD-ROM door in 5 seconds ..." << endl;
    Sleep(5000);
    mciSendString(" set CDAudio door closed", NULL, 0, NULL);

    mciSendString(" close CDAudio", NULL, 0, NULL);

    cin.get(); // wait
    return 0;
    }
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    This is a code error:

    Code:
    #include <windows.h> // Sleep() 
    #include <mmsystem.h> // mciSendString()
    There is no // Sleep() precompiler directive.

    Lines beginning with # are precompiler only. You can't add stuff like comments. Everything on those # lines must be valid precompiler code.

    Comment

    Working...