You are on page 1of 2

1.

Requirements
FDM plugins SDK supports C++ language for now only. If you would like the support to be added for language you use, please write to support@freedownloadmanager.org. Sorry for the possible inconvenience.

2. Short tutorial
Let's start from the short tutorial.

2.1. Make a Win32 DLL project 2.2. Add required exports


FDM looks for initialization function in the DLL. Its prototype should be the such: BOOL FdmApiPluginInitialize (vmsFdmApi* pFdmApi, DWORD* pdwSdkVersionPluginUse) So, DLL should export FdmApiPluginInitialize function. Once DLL will be loaded by FDM, it will call this function. Parameter pFdmApi will point to FDM plugin SDK main interface. Using this interface you can access all FDM's API features included in the current version of SDK. This interface and some other interfaces we'll describe a little later. Now let's implement this function. BOOL FdmApiPluginInitialize (vmsFdmApi*, DWORD *pdwSdkVersion) { *pdwSdkVersion = (FDMSDK_MAJOR_VERSION << 32) | FDMSDK_MINOR_VERSION; MessageBox (NULL, Plugin has been initialized, FDM plugin tutorial, MB_OK); return TRUE; } Interface vmsFdmApi is declared in fdm.h header of FDM plugins SDK, so include it into your project. FDM will call this function twice. First time pFdmApi parameter will be set to NULL. FDM will check if your plugin compatible with it using version information you provide. If it's ok, it will call this function again and provide its main interface. If the function will return FALSE plugin will not be loaded. The second exported function is FdmApiPluginShutdown. It's optional and you may not implement and export it. void FdmApiPluginShutdown () It will be called by FDM when the plugin is about to be unloaded. The third exported function is FdmApiPluginGetDescription (LPSTR pszPluginShortName, LPSTR pszPluginLongName, LPSTR pszPluginVersion, LPSTR pszPluginDescription). Example: void FdmApiPluginGetDescription (LPSTR pszPluginShortName, LPSTR pszPluginLongName, LPSTR pszPluginVersion, LPSTR pszPluginDescription) { strcpy (pszPluginShortName, FDMSP); strcpy (pszPluginLongName, FDM simple plugin); strcpy (pszPluginVersion, 1.0 beta build 5);

strcpy (pszPluginDescription, This plugin helps others understand how to write a plugin for FDM.); } The size of each buffer is 3000 bytes so make sure your description is not longer than this value.

2.3. Put your plugin's DLL into Plugins subfolder of FDM's installation folder. Restart FDM
That's all. The example of simple FDM's plugin is included with our plugins SDK.

3. FDM plugins API interfaces


The main interface is vmsFdmApi. All of its functions has self describing names. Using getDownloadsMgr method you'll get pointer to vmsFdmApiDownloadsMgr interface. Using this interface (vmsFdmApiDownloadsMgr) you may get the number of downloads in FDM, access every download in the FDM, create new download. For now, API is very simple, has few little headers only, so it is not required to write more here. A good starting example in this SDK should help you to get started very fast.

4. The last note


If you think your plugin may be useful to other users, please send it to us at support@freedownloadmanager.org. We'll review it and maybe add it to our site or even FDM's distributive.

You might also like