Manages the sharing of object handles between XLLs.
class psl::HandleCacheInstanceImportManager |
The HandleCacheInstanceImportManager class is a helper class that supports the sharing of object handles between different XLLs. In particular, it allows a one XLL - the handle consumer XLL - to redirect the search for certain classes of object handle to another specific XLL - the handle provider XLL.
The use of the class is very straightforward. In the consumer XLL, during the event handler CXllApp::OnXllOpenEx(), the object types to be found elsewhere shouyld be listed by calling HandleCacheInstanceImportManager::RegisterType(), e.g.:
BOOL CHandleConsumerApp::OnXllOpenEx() { // Inform the controller that handles for the following object types will // be sourced from "HandleProvider.xll" psl::HandleCacheInstanceImportManager::RegisterType(L"Thing", _T("HandleProvider.xll")); psl::HandleCacheInstanceImportManager::RegisterType(L"test::Thing2", _T("HandleProvider.xll")); psl::HandleCacheInstanceImportManager::RegisterType(L"std::map<std::string,std::string>", _T("HandleProvider.xll")); return TRUE; }
The class name argument must be a wide (Unicode) string and must exactly match
the form of the class name used in add-in functions. If a namespace is used
in the add-in function's definition then the namespace must be used
in the RegisterType()
call.
Similarly, if template arguments are used, they must be in exactly the same form as in the add-in function, including white-space.
Note that the XLL name is in standard text form (either ASCII or Unicode depending on the project settings) and that it:
It is also essential that, in the provider XLL, the macro NONRTDHANDLES_IMPLEMENT_EXPORT
is inserted before the inclusion of any handle header file, e.g.:
#define NONRTDHANDLES_IMPLEMENT_EXPORT #include "extensions\StringHandles.h"
See the SharedHandles sample project for an example of the class in use.
Header: nonrtdhandles.h
Namespace: psl
HandleCacheInstanceImportManager Methods | nonrtdhandles.h | Sharing object handles between XLLs (User Guide) | SharedHandles Sample