This is my COM interface:
[id(2)] boolean Init(BSTR User, BSTR Password);
[id(3)] boolean SetBitmap(BSTR szObjectType, IPictureDisp* szBitmap);
The following Init()
function works if the COM interface is registered, or else with the application's manifests using Side-by-side Assemblies (sxs).
Init(LPCTSTR User, LPCTSTR Password)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR VTS_BSTR;
InvokeHelper(0x2, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
User, Password);
return result;
}
However the following SetBitmap()
function works only if the COM interface is registred!
BOOL SetBitmap(LPCTSTR szObjectType, LPPICTUREDISP szBitmap)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR VTS_DISPATCH;
InvokeHelper(0x3, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
szObjectType, szBitmap);
return result;
}
If I use the COM interface configured with the application manifests, the function call fails with error
E_UNEXPECTED
If I replace
VTS_DISPATCH
withVTS_BSTR
, the function call is successful and works. In this case it looks like the dispatcher can't dispatch the object.
Any idea about what is going on?