Currently, Visual plugins allow the creation of internal or external windows and they can tap into PM123 in several ways: they can retrieve currently playing samples, control PM123 and so on.
Visual plugins must implement and export the functions defined in plugin.h. The interface has changed with plugin level 3. Plugins with interface level less than 3 are no longer supported!
Visual plugins must implement and export the functions defined in visual_plug.h.Visual plugin's vis_init routine gets called every time plugin gets activated. The VISPLUGININIT structure contains the initialization data that PM123 passes to the plugin.HWND DLLENTRY vis_init(VISPLUGININIT* initdata);
typedef struct {
int x, y, cx, cy; /* Location where the plugin should create its window */
HWND hwnd; /* PM123's window handle */
PPLUGIN_PROCS procs; /* Pointers to functions which plugins can utilize */
char *param; /* Parameters passed to the plugin */
HAB hab; /* PM123's anchor block handle */
} VISPLUGININIT;
On return from the initialization function, the function should return the plugin's window handle. The plugin shouldn't not rely that initdata structure is pointing to the right location all the time, instead it should make its own copy of the structure.
The plugin parameter param in the VISPLUGININIT structure optionally contains parameters from the skin's .SKN file.
If the plugin creates a window, here's a window procedure you should base yours on:
If you want to create a window inside PM123's window, use WinCreateWindow() in vis_init():MRESULT EXPENTRY PlugWinProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
switch (msg)
{
case DM_DRAGOVER:
case DM_DROP:
case 0x041f:
case 0x041e:
case WM_CONTEXTMENU:
case WM_BUTTON2MOTIONSTART:
case WM_BUTTON1MOTIONSTART:
WinSendMsg(plug.hwnd, msg, mp1, mp2);
break;
/* your stuff */
default:
return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
}
Visual plugins should deinitialize and destroy their windows and free allocated memory when receiving aWinRegisterClass(hab,
"ExamplePlugin",
PlugWinProc,
CS_SIZEREDRAW, 0);
hwndClient = WinCreateWindow(initdata->hwnd,
"ExamplePlugin",
"PM123 Example Visual Plugin",
WS_VISIBLE,
initdata->x, initdata->y,
initdata->cx, initdata->cy,
initdata->hwnd,
HWND_TOP,
initdata->id,
NULL, NULL);
return hwndClient;
int DLLENTRY plugin_deinit();