Announcement

Collapse
No announcement yet.

Empty general purpose plug-in project.

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Empty general purpose plug-in project.

    This is what an empty general purpose plug-in for Winamp 2 (or Winamp5) should look like. Please note that the code is written in C.

    gen_empty.h
    code:
    #ifndef gen_empty_h
    #define gen_empty_h
    #include <windows.h>

    typedef struct {
    int version;
    char *description;
    int (*init)();
    void (*config)();
    void (*quit)();
    HWND hwndParent;
    HINSTANCE hDllInstance;
    } winampGeneralPurposePlugin;

    #define GPPHDR_VER 0x10

    extern winampGeneralPurposePlugin *gen_plugins[256];
    typedef winampGeneralPurposePlugin * (*winampGeneralPurposePluginGetter)();

    #endif

    gen_empty.c
    code:
    #include <windows.h>
    #include "gen_empty.h"

    int init(void);
    void config(void);
    void quit(void);

    winampGeneralPurposePlugin plugin = {
    GPPHDR_VER,
    "MyEmpyProject vx.x (gen_empty.dll)", // Plug-in description
    init,
    config,
    quit,
    };

    int init() {
    MessageBox(plugin.hwndParent,"Init","",MB_OK);
    return 0;
    }

    void config() {
    MessageBox(plugin.hwndParent,"Config","",MB_OK);
    }

    void quit() {
    MessageBox(0,"Quit","",MB_OK);
    }

    // do this to ensure the export isn't mangled if used in a CPP file
    extern "C" {
    __declspec(dllexport) winampGeneralPurposePlugin * winampGetGeneralPurposePlugin() {
    return &plugin;
    }
    }

    More usefull information can be found here:



    The project created in Bloodshed Dev-C++ (a free IDE for the C/C++ programming language) can be downloaded here:


    The project created in Visual C 6 can be downloaded here:


    In case you use an other compiler just add gen_empty.c and gen_empty.h to a clean .dll workspace.

    Thanks go out to bananskib, baafie, KiCHiK and parksie (R.I.P.).

    11-02-2004: Fixed a small bug in the zip files.

    25-01-2009: Added extern "C" for winampGetGeneralPurposePlugin() as too many people are copying C code into CPP files and wondering why the plugin fails to load.

    Last updated: 25-01-2009.
    berkenpi.es
Working...
X