另启动一个线程用来播放声音文件。

解决方案 »

  1.   

    void CSpeaker::WavePlayThread( void* pObj )
    {
        CSpeaker* pSpeaker = ( CSpeaker* )pObj;
        
        pSpeaker->PlaySound(  );    return ;
    }
    void CSpeaker::PlaySound( void )
    {
        sndPlaySound( szFileName, SND_SYNC | SND_NODEFAULT );
    }
    void CSpeaker::epExec(  )
    {
        _beginthread( WavePlayThread, 0, this );
    }
    class CSpeaker
    {
    public:
        CSpeaker(  );
        ~CSpeaker(  );private:
        static void             WavePlayThread  ( void* );public:
        void                     PlaySound       ( void );
        void                     epExec          ( void );
    };