Re: Win32Lib: PlaySound parameters
- Posted by David Cuny <dcuny at LANSET.COM> Nov 02, 1999
- 514 views
Dan Moyer wrote: > I understand almost nothing about the API wrapping, so > is there anything that can be done here to make use of > the PlaySound FUNCTION?? I didn't have any documentation for the PlaySound function, so I just filched the code from a demo of Robert's. Robert declared the routine as a procedure, and so that's what I did as well. The 'A' and 'W' at the end of the function name designate if the routine takes as ANSI string (1 byte per character) or a Unicode (W=wide=2 bytes per character). If there is no 'A' or 'W', the 'A' is probably assumed. In C, all routines return a value - even if it's just NULL. If you don't use the value returned by the routine; i.e.: foo( bar ) then the C compiler just discards the result. So the distinction that Euphoria makes between a C procedure and function is a bit artificial. To convert the PlaySound call into a function, use define_c_func() instead of define_c_proc(), (for Win32Lib, use linkFunc and linkProc) and specify the type of value the routine returns (C_INT, C_LONG, C_POINTER, etc.). The prototype would look something like this: xPlaySound = linkFunc( winmm, "PlaySoundA", {C_INT, C_INT, C_INT}, C_INT ) Hope this helps! -- David Cuny