Thread: playsound2

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    14

    playsound2

    i create a pda os project.
    and add a subproject which play sound under this os project.
    Now i can successfully build it.
    I place my wave file in the release directory.
    and use windows ce command prompt to run my subproject
    but it has no response, there is no sound comes out.
    i cannot figure out what's wrong with it.
    please help. thank you!
    My subporject code is in the following
    Code:
    #include <windows.h> 
    #include <mmsystem.h> 
    int WINAPI WinMain(HINSTANCE hInstance, 
                                   HINSTANCE hPreInstance,
                                  LPWSTR lpCmdLine,
                                  int nShowCmd)
    {
            PlaySound(L"release\\test16bit.wav", NULL, SND_FILENAME);
            return 0;
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    http://msdn.microsoft.com/en-us/library/ms712879.aspx
    1. It returns an error status, use it.
    2. L"" is all very well if you always assume wide chars. Using the TEXT() macro would be much better.
    3. Popup a message box showing you what the current working directory is.

    release\test16bit.wav may be fine if you run it from your IDE, but if you just run the executable from explorer, it's probably just .\test16bit.wav
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed