GEN.H 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef NULLSOFT_WINAMP_GEN_H
  2. #define NULLSOFT_WINAMP_GEN_H
  3. // General Purpose plugin interface
  4. #include <windows.h>
  5. typedef struct {
  6. int version;
  7. char* description;
  8. int(__cdecl* init)();
  9. void(__cdecl* config)();
  10. void(__cdecl* quit)();
  11. HWND hwndParent;
  12. HINSTANCE hDllInstance;
  13. } winampGeneralPurposePlugin;
  14. // return values from the init(..) which determines if Winamp will continue loading
  15. // and handling the plugin or if it will disregard the load attempt. If GEN_INIT_FAILURE
  16. // is returned then the plugin will be listed as [NOT LOADED] on the plug-in prefs page.
  17. #define GEN_INIT_SUCCESS 0
  18. #define GEN_INIT_FAILURE 1
  19. #define GPPHDR_VER 0x10
  20. // added 5.64+
  21. #define GPPHDR_VER_U 0x11
  22. // specify GPPHDR_VER_U if you want to provide a unicode (wchar_t*) description and only work on 5.64+
  23. // specify GPPHDR_VER to use the original (char*) description as before
  24. // note: we are using the fact that sizeof(char*) == sizeof(wchar_t*) to be able to allow this
  25. // so when using GPPHDR_VER_U you will need to cast description to (wchar_t*) to set
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. typedef winampGeneralPurposePlugin* (__cdecl* winampGeneralPurposePluginGetter)();
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. // These are the return values to be used with the uninstall plugin export function:
  34. // __declspec(dllexport) int __cdecl winampUninstallPlugin(HINSTANCE hDllInst, HWND hwndDlg, int param)
  35. // which determines if Winamp can uninstall the plugin immediately or on winamp restart.
  36. // If this is not exported then Winamp will assume an uninstall with reboot is the only way.
  37. //
  38. #define GEN_PLUGIN_UNINSTALL_NOW 0x1
  39. #define GEN_PLUGIN_UNINSTALL_REBOOT 0x0
  40. //
  41. // Uninstall support was added from 5.0+ and uninstall now support from 5.5+ though note
  42. // that it is down to you to ensure that if uninstall now is returned that it will not
  43. // cause a crash i.e. don't use if you've been subclassing the main window.
  44. //
  45. // The HWND passed in the calling of winampUninstallPlugin(..) is the preference page HWND.
  46. //
  47. // The following is a psuedo example of using winampUninstallPlugin(..) which shows its usage:
  48. //
  49. //
  50. // // use this as a control on saving settings as quit(..) will be called afterwards
  51. // int no_uninstall = 1;
  52. // __declspec(dllexport) int __cdecl winampUninstallPlugin(HINSTANCE hDllInst, HWND hwndDlg, int param){
  53. // // prompt to remove our settings with default as no (just incase)
  54. // if(MessageBox(hwndDlg,"Do you also want to remove the saved settings for this plugin?",
  55. // plugin.description,MB_YESNO|MB_DEFBUTTON2) == IDYES)
  56. // {
  57. // // PLUGIN_NAME is the name of the section you save settings into
  58. // // and this call will make the OS remove the setion passed
  59. // WritePrivateProfileString(PLUGIN_NAME,0,0,ini_file);
  60. // no_uninstall = 0;
  61. // }
  62. // // as we're doing too much in subclasses, etc we cannot allow for on-the-fly removal so need to do a normal reboot
  63. // return GEN_PLUGIN_UNINSTALL_REBOOT;
  64. // }
  65. //
  66. // For a general purpose plugin to be correctly detected by Winamp you need to ensure that
  67. // the exported winampGetGeneralPurposePlugin(..) is exported as an undecorated function
  68. // e.g.
  69. // #ifdef __cplusplus
  70. // extern "C" {
  71. // #endif
  72. // __declspec(dllexport) winampGeneralPurposePlugin * __cdecl winampGetGeneralPurposePlugin(){ return &plugin; }
  73. // #ifdef __cplusplus
  74. // }
  75. // #endif
  76. //
  77. #endif