Currently, Visual plug-ins 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 plug-ins must implement and export the functions defined in plugin.h. The interface has changed with plug-in level 3. Plug-ins with interface level less than 3 are no longer supported!
Visual plug-ins must implement and export the functions defined in visual_plug.h.Visual plug-in's vis_init routine gets called every time plug-in gets activated. The VISPLUGININIT structure contains the initialization data that PM123 passes to the plug-in.HWND DLLENTRY vis_init(VISPLUGININIT* initdata);
typedef struct {
int x, y, cx, cy; /* Location where the plug-in should create its window */
HWND hwnd; /* PM123's window handle */
PPLUGIN_PROCS procs; /* Pointers to functions which plug-ins can utilize */
char *param; /* Parameters passed to the plug-in */
HAB hab; /* PM123's anchor block handle */
} VISPLUGININIT;
On return from the initialization function, the function should return the plug-in's window handle. The plug-in 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 plug-in parameter param in the VISPLUGININIT structure optionally contains parameters from the skin's .SKN file.
If the plug-in 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 plug-ins 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 Plug-in",
WS_VISIBLE,
initdata->x, initdata->y,
initdata->cx, initdata->cy,
initdata->hwnd,
HWND_TOP,
initdata->id,
NULL, NULL);
return hwndClient;
int DLLENTRY plugin_deinit();