» Home

  » Plugins

      » Mime

            » Developers Guide

               » Quick Reference

Brass Plugins: Mime Developers Guide

 

A Mime Plugin Skeleton File

Click here to download a skeleton .CPP file containing the base code for a plugin DLL. You can use this as a starting point and reference for your plugin DLL.

 

The Current Mime Interface Versions

Your version export function in your plugin DLL should be as follows:


extern "C" __declspec(dllexport) void GetPluginMimeInterfaceVersion(ACTIONVERSION* pVersion)
{
    pVersion->m_iMajorVersion = 0;
    pVersion->m_iMinorVersion = 1;
    pVersion->m_iBuildVersion = 1;
}

This is the current version of the Mime interface and supports all features described in the developer guide.

 

Quick Reference Guide for adding Mime gesture support to your application

 

  1. Decide on some way for the action DLL to interface with your application. An easy way to do this is to create a set of custom messages which are PostMessage()'d from the plugin DLL to your application's window. Other options include adding automation support, DDE or COM. Your choice. This guide will assume you use messages.


  2. Write the custom message handlers into your application, for example WM_GESTURE_DOALITTLEDANCE would call the DoALittleDance function.

  3. Create a standard DLL project and remove DLLMain.


  4. Duplicate any custom WM_ defines that are in your main app into the DLL .cpp


  5. Paste the WINDOWCRITERIA struct, the ACTIONVERSION struct and the GetPluginMimeInterfaceVersion function definitions into the DLL .cpp


  6. Create an exported action function that posts a custom message back to the main application. Name the function appropriately.


  7. Create an exported criteria function, named the same as the action function but suffixed with "Criteria", that fills out the WINDOWCRITERIA struct with the appropriate criteria.



    Repeat steps 6 & 7 for all functions you want to add gestures support for

  8. Create the descriptor file, named the same as the DLL but with a .NFO extension.


  9. Install the DLL and NFO file to the Plugins\Mime directory in the Brass install directory. Finish.

 

Reference

The WINDOWCRITERIA struct, included in every DLL.

typedef struct _tagWindowCriteria
{
    char m_szWindowName[MAX_PATH];
    char m_szWindowClassName[MAX_PATH];
    char m_szParentWindowName[MAX_PATH];
    char m_szParentWindowClassName[MAX_PATH];
    char m_szOverallWindowName[MAX_PATH];
    char m_szOverallWindowClassName[MAX_PATH];
} WINDOWCRITERIA;

 

The prototype for all Action functions:

extern "C" __declspec(dllexport) void DoSomething(HWND hWnd, const char* szParam)
{
    if(strlen(szParam) == 0 || strcmp("0", szParam))
    {
        // No parameter was supplied by the user, handle this
    }

    // Normal implementation

}

 

The prototype for all Criteria functions:

extern "C" __declspec(dllexport) void DoSomethingCriteria(WINDOWCRITERIA* pCriteria)
{
    ZeroMemory(pCriteria, sizeof(WINDOWCRITERIA));
}

 

The format of the descriptor file:

; Comment lines begin with a semi colon
DisplayName::My Application
FeatureSet::Gestures for my App. Criteria: Must be in my app.
DoSomething::Do Something::0::Does something with the app, no parameter needed
DoSomethingElse::Something Else::What to do?::Something else, needs parameter