MMBDLL
copyright © 2002-2003 Squash Productions
WinAPI - VB to MMB

 

This will give you a basic idea of how to change the vb winapi declarations into MMB code to work with the MMBDLL plugin.

Lets see an example:
The MessageBeep function plays a waveform sound. The waveform sound for each sound type is identified by an entry in the [sounds] section of the registry.
The following if the winapi in Visual Basic to run the beep command:

Declare Function MessageBeep Lib "user32" Alias "MessageBeep" (ByVal wType As Long) As Long

First separate this calling into different parts:

  1. Declare Function MessageBeep: this is the internal name that vb is going to give the api, you do not need to use this part of the code.


  2. Lib "user32": This tells vb where which is the library that it should look under to run the command. In this case User32. In your MMB code this would be the path of the dll. You must then simply add a .dll to this, and it should look like this:
  3.  Path$ = 'User32.dll'
     PluginSet("PlugIn","Path$")
     PluginRun("PlugIn","Path")

  4. Alias "MessageBeep": This is the function that is going to be called once the library is loaded. In your MMB code this would be equivitante to the Functions command. Convert it to the following: 

  5.  Functions$ = 'MessageBeep'
     PluginSet("PlugIn","Functions$")
     PluginRun("PlugIn","Functions")

  6. (ByVal wType As Long) As Long: these are the parameters. They are separated by commas. So in this case there are only 1. This parameter is to set the type of MessageBeep you want to run. For this example we are going to use the MB_ICONQUESTION type. (More info on this winapi here: http://www.mentalis.org/apilist/MessageBeep.shtml )


  7.  Parameters$ = 'MB_ICONQUESTION'
     PluginSet("PlugIn","Parameters$")
     PluginRun("PlugIn","Parameters")

Using this code in your MMB proyect with the MMBDLL plugin should run the waveform sound, just like when a Question message comes up...

Back to contents