PDA

Click to See Complete Forum and Search --> : Make winmm.dll stop!!!


ljameslo
Oct 26th, 2001, 10:51 AM
Hopefully someone outthere can stop this madness.

we are using the playsound function in winmm.dll to play an alarm sound in a loop. When when the application eixt not properly, the instance of winmm.dll will stay in memory and keep playing the alarm in loop. I am just hoping there is a way to stop it outside of the origin application. I know I have create a memory leak when this is happening, is there a way to kill the instance of dll running?

thanks

- L. James Lo, MCSD

sproll
Oct 27th, 2001, 05:14 AM
Example:

dim claTest as ClassName
set claTest=nothing

or have you close the device?

dim lAPIReturn as long
lAPIReturn =mciExecute("close DeviceName")

and a question,are u a MCSD?
can u tell me some advices how I can pass MCSD?

Waiting for your teaching!
sproll@163.com

jim mcnamara
Oct 27th, 2001, 06:49 AM
Instead of linking it into the project, call LoadLibrary()
then FreeLibrary() in the Form_QueryUnload().

That way if the program exits, FreeLibrary() will remove the
PlaySound api (or whatever) from memory.

Unless the winmm.dll is in an ActiveX control. Then you are stuck.

Eyes.Only
Oct 27th, 2001, 05:28 PM
I was using sndPlaySound Lib "winmm.dll" to play wavs from a data stream i held in memory (didnt want to create a temp file). The way i stopped it was used the Forms Terminate event and ran the stop command in there for those times when it would close abnormally.

But Ive found that playing many wavs consecutively with this API tends to suck up the memory, so i need to free it or unload it after each wav it plays. So Im quite curious how i can use the LoadLibrary() and FreeLibrary(). I guess ive never seen it used before.