There are a couple different ways you can get started with ACDSee plug-in development. While you can modify one of the provided sample plug-ins from the "Samples" folder in this SDK, these instructions cover how to write a plug-in from the beginning.
Click images to view in full size.
To Write a Plug-In from Scratch:
If you are using an alternative IDE, then set up your build configuration to build to a DLL. Make sure to choose a name and location for your new plug-in project.
Code Snippet:
; CX_MyNewSample.def : Declares the module parameters for the DLL.
LIBRARY "CX_MyNewSample.apl"
EXPORTS
CX_Init
CX_GetPlugInInfo
CX_InvokeCommand
CX_Free
For this example, we are exporting CX_Init, CX_GetPlugInInfo, CX_InvokeCommand, and CX_Free. You can find more information on command extension plug-ins here.
Code Snippet:
// CX_MyNewSample.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include <stdlib.h>
#include <string>
#include "C:\ACDSeePhotoStudioSDK\API\CX_PlugIn.h"
CX_PlugInInfo* g_PlugInInfo = nullptr;
PLUGIN_API int __stdcall CX_Init(
CX_ClientInfo* pci) // (in) Information about the plug-in client (host)
{
std::wstring HelloWorld(L"Hello World!");
g_PlugInInfo = new CX_PlugInInfo;
wcsncpy_s(g_PlugInInfo->szTitle, HelloWorld.c_str(), _countof(g_PlugInInfo->szTitle));
g_PlugInInfo->dwFlags = CX_CI_CATEGORIES;
g_PlugInInfo->nVersion = CX_VERSION;
g_PlugInInfo->nCommands = 1;
g_PlugInInfo->pCommandInfo = new CX_CommandInfo[1];
g_PlugInInfo->pCommandInfo[0].dwCategories = CX_CN_CREATE;
wcsncpy_s(g_PlugInInfo->pCommandInfo[0].szName, HelloWorld.c_str(), _countof(g_PlugInInfo->pCommandInfo[0].szName));
wcsncpy_s(g_PlugInInfo->pCommandInfo[0].szMenuItemName, HelloWorld.c_str(), _countof(g_PlugInInfo->pCommandInfo[0].szMenuItemName));
wcsncpy_s(g_PlugInInfo->pCommandInfo[0].szDescription, HelloWorld.c_str(), _countof(g_PlugInInfo->pCommandInfo[0].szDescription));
return CXE_OK;
}
PLUGIN_API int __stdcall CX_Free()
{
if(g_PlugInInfo != nullptr)
{
if(g_PlugInInfo->pCommandInfo != nullptr)
{
delete[] g_PlugInInfo->pCommandInfo;
g_PlugInInfo->pCommandInfo = nullptr;
}
delete g_PlugInInfo;
g_PlugInInfo = nullptr;
}
return CXE_OK;
}
PLUGIN_API int __stdcall CX_GetPlugInInfo(
CX_PlugInInfo** ppii) // (out) Plug-in information
{
*ppii = g_PlugInInfo;
return CXE_OK;
}
PLUGIN_API int __stdcall CX_InvokeCommand(
CX_CommandParams* pcp,// (in ) Specifies command to invoke, and parameters
CX_CommandResults* pcr)// (out) Command results
{
MessageBoxW(pcp->hwndParent, L"Hello World!", L"Hello World!", MB_OK);
return CXE_OK;
}
Success!