There is an interface descriptor flag, FP_CORE, which must be specified on Core interface descriptors. Static Core interface descriptors are now automatically registered with the Core, so you do not need to explicitly call RegisterCOREInterface() on them. The code examples below include a Core interface using this flag. The following example taken from the DragAndDrop manager interface.
The public interface definition (in a public header file)
classIDragAndDropMgr : public FPStaticInterface { public: virtualvoid EnableDandD(BOOL flag)=0; virtual BOOL IsEnabled()=0; virtual BOOL EnableDandD(HWND hwnd, BOOL flag, DragAndDropHandler* handler = NULL)=0; virtual BOOL DropPackage(HWND hwnd, POINT& point, URLTab& package)=0; virtual BOOL DownloadPackage(URLTab& package, TCHAR* directory, HWND hwnd = NULL)=0; virtual TCHAR* GetStdDownloadDirectory()=0; };
The implementation class (in the .cpp implementation file)
Note in this example, a couple of the interface methods use a new type, URLTab, which is not a ParamType2 type. This is a Tab< TCHAR*> specialization and so provides overloads that take Tab< TCHAR*>'s and convert them to URLTabs, specifically for dispatch-based calls.
classDragAndDropMgr : IDragAndDropMgr { ... public: void EnableDandD(BOOL flag) { global_enable = flag; } BOOL IsEnabled() { return global_enable; } BOOL EnableDandD(HWND hwnd, BOOL flag, DragAndDropHandler* handler = NULL); BOOL DropPackage(HWND hwnd, POINT& point, URLTab& package); BOOL DropFiles(HWND hwnd, HDROP hDrop); BOOL DownloadPackage(URLTab& package, TCHAR* directory, HWND hwnd = NULL); TCHAR* GetStdDownloadDirectory(); // variants for FnPub interface that take Tab<TCHAR*>s BOOL DropPackage(HWND hwnd, POINT& point, Tab<TCHAR*>& package); BOOL DownloadPackage(Tab<TCHAR*>& package, TCHAR* directory); DECLARE_DESCRIPTOR(DragAndDropMgr) // dispatch map BEGIN_FUNCTION_MAP VFN_1( dndmgr_globalEnableDnD, EnableDandD, TYPE_BOOL); FN_0( dndmgr_isEnabled, TYPE_BOOL, IsEnabled); FN_2( dndmgr_enableDandD, TYPE_BOOL, EnableDandD, TYPE_HWND, TYPE_BOOL); FN_3( dndmgr_dropPackage, TYPE_BOOL, DropPackage, TYPE_HWND, TYPE_POINT_BR, TYPE_STRING_TAB_BR); FN_2( dndmgr_downloadPackage, TYPE_BOOL, DownloadPackage, TYPE_STRING_TAB_BR, TYPE_STRING); FN_0( dndmgr_downloadDirectory, TYPE_STRING, GetStdDownloadDirectory); END_FUNCTION_MAP ... };
The descriptor, note the FP_CORE flag.
FP_CORE descriptors are automatically registered with RegisterCOREInterface().
DragAndDropMgrdragAndDropMgr(DND_MGR_INTERFACE, _T("dragAndDrop"), IDS_DND_INTERFACE, NULL, FP_CORE, dndmgr_globalEnableDnD, _T("globalEnableDragAndDrop"), 0, TYPE_BOOL, 0, 1, _T("onOff"), 0, TYPE_BOOL, dndmgr_isEnabled, _T("isEnabled"), 0, TYPE_BOOL, 0, 0, dndmgr_enableDandD, _T("enableDragAndDrop"), 0, TYPE_BOOL, 0, 2, _T("window"), 0, TYPE_HWND, _T("onOff"), 0, TYPE_BOOL, dndmgr_dropPackage, _T("dropPackage"), 0, TYPE_BOOL, 0, 3, _T("window"), 0, TYPE_HWND, _T("mousePoint"), 0, TYPE_POINT_BR, _T("files"), 0, TYPE_STRING_TAB_BR, dndmgr_downloadPackage, _T("downloadPackage"), 0, TYPE_BOOL, 0, 2, _T("files"), 0, TYPE_STRING_TAB_BR, _T("directory"), 0, TYPE_STRING, dndmgr_downloadDirectory, _T("geStdtDownloadDirectory"), 0, TYPE_STRING, 0, 0, end