Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to use "notify" callback with winmm.dll

I have an Excel user form with a button that plays a wav file using
mciSendString. I am trying to make use of the notify parameter so I can take
some action when the file is done playing, but I can't get it to work. Here
is my relevant code:

Call mciSendString("play WavFile notify", 0, 0, AddressOf mciSendStringProc)

This is supposed to send the notify message to a procedure called
mciSendStringProc (located in a module). Here is the code for that:

Public Function mciSendStringProc(ByVal hWnd As Long, ByVal uMsg As Long,
ByVal wParam As Long, ByVal lParam As Long) As Long

MsgBox uMsg & wParam & lParam

mciSendStringProc = True

End Function

The wav file plays successfully, but I cannot get anything to happen when
it's finished.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to use "notify" callback with winmm.dll

Thanks, Chip. But I also need the user to be able to stop the wave file at
any time (using another button). Using the Wait parameter suspends the form
until the file is done. It seems like utilizing the dll's callback is the
solution, but I can't get it to work.

"Chip Pearson" wrote:

See the code at http://www.cpearson.com/Excel/PlaySound.aspx. This
shows how to use the PlaySound API function to play a wav file
synchronously (wait for complete) or asynchronously.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 15 Sep 2009 15:43:03 -0700, Jpeg Jones <Jpeg
wrote:

I have an Excel user form with a button that plays a wav file using
mciSendString. I am trying to make use of the notify parameter so I can take
some action when the file is done playing, but I can't get it to work. Here
is my relevant code:

Call mciSendString("play WavFile notify", 0, 0, AddressOf mciSendStringProc)

This is supposed to send the notify message to a procedure called
mciSendStringProc (located in a module). Here is the code for that:

Public Function mciSendStringProc(ByVal hWnd As Long, ByVal uMsg As Long,
ByVal wParam As Long, ByVal lParam As Long) As Long

MsgBox uMsg & wParam & lParam

mciSendStringProc = True

End Function

The wav file plays successfully, but I cannot get anything to happen when
it's finished.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
what is "Notify before state loss" clara Excel Programming 1 June 5th 08 06:32 PM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"