Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 4th, 2012  |  syntax: C  |  size: 1.27 KB  |  hits: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //
  2. // gcc myplugin.c -shared -o ml_myplugingcc.dll
  3. // copy ml_myplugingcc.dll to 'C:\Program Files (x86)\Winamp\Plugins'
  4. //
  5.  
  6. #include <windows.h>
  7.  
  8. #define MLHDR_VER 0x15
  9.  
  10. typedef struct {
  11.         int version;
  12.         char *description;
  13.         int (*init)();
  14.         void (*quit)();
  15.         INT_PTR (*MessageProc)(int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3);
  16.         HWND hwndWinampParent;
  17.         HWND hwndLibraryParent;
  18.         HINSTANCE hDllInstance;
  19. } winampMediaLibraryPlugin;
  20.  
  21. int Init()
  22. {
  23.         return 0;
  24. }
  25.  
  26. void Quit()
  27. {
  28.         MessageBoxA(NULL, "Quit() from C", "Message", 0);
  29. }
  30.  
  31. INT_PTR MessageProc(int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3)
  32. {
  33.         return 0;
  34. }
  35.  
  36. winampMediaLibraryPlugin plugin =
  37. {
  38.         MLHDR_VER,
  39.         "My Cool Plugin C",
  40.         Init,
  41.         Quit,
  42.         MessageProc,
  43.         0,
  44.         0,
  45.         0,
  46. };
  47.  
  48. __declspec(dllexport) winampMediaLibraryPlugin *winampGetMediaLibraryPlugin()
  49. {
  50.         return &plugin;
  51. }
  52.  
  53. BOOL __stdcall DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
  54. {
  55.     switch (ulReason)
  56.     {
  57.         case DLL_PROCESS_ATTACH:
  58.             break;
  59.  
  60.         case DLL_PROCESS_DETACH:
  61.             break;
  62.  
  63.         case DLL_THREAD_ATTACH:
  64.             break;
  65.  
  66.         case DLL_THREAD_DETACH:
  67.             break;
  68.  
  69.                 default:
  70.                         break;
  71.     }
  72.  
  73.     return TRUE;
  74. }