The other day I was adding sound into my project for work. The ability to play sound in .NET is not native; there is not a sound namespace. In order to do this I had to use platform invocation services and unmanaged assemblies, specifically the winmm.dll. There are a number of tutorials on how to accomplish this so I will not provide mine here.
What I did find interesting is how does one determine the appropriate function signatures of the unmanaged assemblies? In my case I am told the signature to the PlaySound method of the winmm.dll is PlaySound(string Sound, IntPtr Mod, int SoundFlag) where I use an enum to represent SoundFlag. What I am trying to determine is how could I have discovered the signature of PlaySound if I had not been told in a tutorial? I know these signatures exist in some H file somewhere, but where?
I was introduced to
DependencyWalker, a free utility that examines assemblies, executables, and more. I loaded up my winmm.dll, and I could now see all the functions available within this assembly, but I still cannot see what parameters those functions require. I then installed
Asmex, a free .NET assembly utility. Again, while I can see my PlaySound function, I cannot tell what it takes.
If anyone knows of a solution to this problem, I would be grateful to hear it.