Home > development, Piger > The “Hello Dolly” of piger

The “Hello Dolly” of piger

November 25th, 2009

I created a small c++ plugin to show the basic architecture of the piger plugin.
WordPress has a very simple plugin that they called ‘Hello Dolly’, this plugin does not really do much apart from randomly displaying a lyric from “Hello Dolly

First things first, download the latest source code of the plugin and we will talk about each files in a bit more details.

The file type:
The file is nothing more than a DLL with an ‘.amp’ extension. So when you create your plugin make sure that the output file has a ‘.amp’ extension.

The files to include:
You need to include 2 files, a header(h) file and a library(.lib) file.

// support for PluginAPI
#include "../../api/amplugin/amplugin.h"

// add the libs
#ifdef _DEBUG
#pragma comment(lib, "../../debug/amplugin.lib" )
#else
#pragma comment(lib, "../../release/amplugin.lib" )
#endif

And in the cpp file, the one and only function.

PLUGIN_API
AM_RESPONSE am_Msg( AM_MSG msg, WPARAM wParam, LPARAM lParam  )
{
  return AM_RESP_NOT_SUPPORTED;
}

Some important messages…

...
  switch( msg )
  {
  case AM_MSG_INIT:   // called when the plugin is first loaded.
  case AM_MSG_DEINIT: // called when we are closing the app
  case AM_MSG_MAIN:   // called when one, (or more), of the commands we 
                      // registered are called.
  }

When the message ‘AM_MSG_INIT’ is called you can add an action using the ‘addAction( … )‘ function.

AM_MSG_MAIN will be called when that action is entered.

Things to note:

  • Place your plugin in the __in folder, (normally found in %appdata%\MyOddWeb\ActionMonitor_d\RootCommands\__in).
  • Don’t mix debug and release builds, to debug your plugin you will need to run it again the debug version of Action monitor, (and the folder is %appdata%\MyOddWeb\ActionMonitor_d\RootCommands\__in).
  • Have a look at the file “#include “am_plugins.h”“, it explains what most messages do.
  • Call [Caps lock] this.reload to reload everything.
  • Download the plugin code here.

Visit the forum if you have any technical questions.

Categories: development, Piger Tags:
Comments are closed.