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_UNEXPECTEDIf I replace
VTS_DISPATCHwithVTS_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?
IPictureDispparameter is not a problem for registration free COM.What seems to be wrong here is the way you create the manifest XML. If your IDL is defined for the ActiveX DLL, and the library has the actual TLB then your client binary manifest should have the reference and not the DLL's manifest:
Also,
booleanIDL method result types should normally beHRESULTs instead. There are also other problems (as pointed by others) as well as your real unposted code might have even additional problems. Still, the case as you explained it can work out just fine if you fix the manifest, you can useRegFreeComPictureDispsolution with your code snippets (client, server, IDL, manifest excerpt) as a reference to fix your project (Trac, Subversion).