View Single Post
Old 18th March 2003, 17:10   #1
Kaboon
Moderator
 
Kaboon's Avatar
 
Join Date: Jun 2000
Location: Netherlands
Posts: 2,494
Send a message via ICQ to Kaboon
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:
http://forums.winamp.com/showthread....threadid=82651
http://forums.winamp.com/showthread....hreadid=103667

The project created in Bloodshed Dev-C++ (a free IDE for the C/C++ programming language) can be downloaded here:
http://www.berkenpies.nl/wa/gen_empty.zip

The project created in Visual C 6 can be downloaded here:
http://www.berkenpies.nl/wa/gen_empty_vc6.zip

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.
Kaboon is offline