Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Menu Commands and Sound Threads Collapse All
Subject Author Date
Yusuf Abdulkadir Jun 29, 2006 - 8:55 AM

Background:
My main UI application is a DLL. I started with a regualr MDI and converted it to a DLL. The main UI is loaded by a background task as a seperate thread. It is working ok, except for one issue

ISSUE:
I have noticed that when ever a menu command is used what seems a sound thread is created and a sound is played?? Is this a standred Prof-UI feature? If I don’t support sound can I disable this functionality?

Also, when the application is closed, the main UI which is a DLL is unloaded from memory. When the application is closed, I do the following cleanups

void CsMainUIApp::OnAppExit()
{
// TODO: Add your command handler code here
::PostQuitMessage(0);
}

int CsMainUIApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class

CloseAllDocuments(TRUE);

//--if we were started by the Kernel, let us notify it we are closing the app
//---Send a message to Kernel.

//---Destroy the main window
if(m_pMainWnd)
m_pMainWnd->DestroyWindow();
delete m_pMainWnd;

return CsBaseUIApp::ExitInstance();
}

During the application exit, Prof-UIs Assets at the following location

void CExtSoundPlayer::InternalSoundThredadParms_t::PlaySound()
{
.......
//---My comments - m_hModule is NULL
HANDLE hModule = m_hModule;

DWORD dwPlayerFlags = m_dwPlayerFlags;
    if( m_pEventInitDone != NULL )
        m_pEventInitDone->SetInitDone();
#ifdef __TRACE_SOUND_PLAYER_THREAD
    TRACE1("CExtSoundPlayer::InternalSoundThredadParms_t::PlaySound(\"%s\") - START\n",sSoundSpecBuffer);
#endif // __TRACE_SOUND_PLAYER_THREAD
    if( (m_dwPlayerFlags & SND_ASYNC) != 0 )
        ::PlaySound( NULL, NULL, SND_PURGE );
}


When unload my DLL, do I need to notify Prof-UIs it needs to do clean up as well?

Thanks for your support.

Technical Support Jun 29, 2006 - 11:13 AM

The menu sound is supported as the standard feature of Windows menus. The global sound player object is used as implementation of this feature. You can install your own sound player using the following code:

g_SoundPlayer.InstallSoundPlayer( new MySilencePlayer )
The source code for the MySilencePlayer class should look like:
class MySilencePlayer : public CExtSoundPlayer
{
public:
    DECLARE_DYNCREATE( MySilencePlayer );
    MySilencePlayer()
    {
    }
    virtual ~MySilencePlayer()
    {
    }
    virtual void PlaySound(
        CExtSoundPlayer::e_ui_sounds_t eSoundID
        )
    {
        eSoundID;
        // WE ARE PLAYING SILENCE HERE
    }
};
 
IMPLEMENT_DYNCREATE( MySilencePlayer, CExtSoundPlayer );
This version of the sound player will let you avoid menu sounds.

We need more details about where the assertion failure occur because the CExtSoundPlayer::InternalSoundThredadParms_t::PlaySound() method referred in your message does not contain any assertions.