How to Play a Sound File with Dexterity

Dave DusekThis is really an extension of the blog article that David Musgrave wrote VBA – Welcome to Dynamics Example, but instead of using VBA to play the sound file, we are using Dexterity. The same method is called in the winmm.dll, but this is just the Dexterity way to do it. I didn’t include trigger information on this because you could really put this anywhere.

I am playing the Welcome.wav, but you could play any wav file with this.  This came up in a recent support incident, so that’s why I’m posting this info.    

First, you need to create a Dexterity prototype procedure.  Here is what that would look like.  The name is important and must be PlaySound@winmm.dll.

PlaySound@winmm.dll Global Procedure

Now, you just need to call the method via the extern command.  Here is what your calling script would look like:

Example Calling Script

Dave Dusek
Dynamics GP Developer Support

// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL,

Comments (6)

  1. mgomezb says:


    Simple and sweet!


    Mariano Gomez, MVP

    Maximum Global Business, LLC

  2. nilotpal says:

    do we have to register the DLL if it is a new kind of DLL?

  3. David Musgrave says:

    Hi Nilotpal

    When using the extern statement to call a win32 dll, there is no need to register/unregister it.

    Thanks to Pat for this info.


  4. nilotpal says:


    but i wrote the DLL in Visual basic 2005, and not able to call it. Please refer to my post “calling dll from dexterity”.



  5. nilotpal says:


    i created the DLL form Visual Basic Class library, so is it win32 dll? if not, then how to use it in dexterity?

  6. Patrick Roth [MSFT] says:

    You cannot create a Win32 assembly using vb 2005 so that is why it doesn’t work.  That is only possible from C/C++.  

    From .net, you would have to create your assembly so that it is COM interop enabled.  Then you’d use normal COM method calls from Dexterity to call those methods.

    That should get you going.  If you have any further questions please open a support incident or post to the newsgroups.


    dev support