
This is a reposting of an article Dave Duesk originally wrote on my Developing for Dynamics GP blog.
This 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
[code]
{PlaySound@winmm.dll}
out long return_value;
in string lsoundfile;
in long hModule;
in long dwFlags;
[/code]
Now, you just need to call the method via the extern command. Here is what your calling script would look like:
Example Calling Script
[code]
local string lpath;
local long hModule;
local long dwFlags;
local long result;
lpath = "c:backupdexwelcome.wav";
hModule = 1;
dwFlags = 1;
extern ‘PlaySound@winmm.dll’,result, lpath, hModule,dwFlags;
[/code]
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, http://opensource.org/licenses/ms-pl.html.)
This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on http://www.winthropdc.com/blog.
Dave,
Simple and sweet!
MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com
do we have to register the DLL if it is a new kind of DLL?
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.
David
Thanks,
but i wrote the DLL in Visual basic 2005, and not able to call it. Please refer to my post “calling dll from dexterity”.
regards,
nilotpal
hi,
i created the DLL form Visual Basic Class library, so is it win32 dll? if not, then how to use it in dexterity?
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.
patrick
dev support