|
The project I am involved with at work is using the jintegra product to do just this, not sure what your requirements are but it is working at our level, which is a ~30 engineer project, running for 1 year so far. There are few 'gotchas' relating to things like type conversions and function overloading. Our prototyping effort/trial to get up to speed was about 1 engineer for 6 weeks.
see:
http://www.linar.com/
David
|
|
|
|
|
How in the world can i get this to work
if i use IXMLDOMNode in the idl it compiles
if i use the using namespace in the c++ code i'm still good
however the headers created from the idl result in the following:
error C2872: 'IXMLDOMNode' : ambiguous symbol
Help!
|
|
|
|
|
|
I have been coding C++ for a while with ATL 3.0 and 7.0. However I cannot figure out how to access the IE com object view ATL 7. Does anyone know a good resource on this as I need to manipulate settings in the browser dynamically with a COM object. The MS Reference Library is no longer available and who knows what they will replace it with.
|
|
|
|
|
ATL has nothing to do with IE.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
|
I have an existing MFC application to which I added some ATL objects. Everything seems to work fine, except that it appears MIDL has changed property names of 'Count', 'Address', and 'Date', to 'count', 'address', and 'date' in the generated type library. Properties with other names are handled OK.
I can create a whole new ATL project from scratch and use these property names with no problem. It seems to fail only with these 'afterthought' objects.
|
|
|
|
|
It seems to me that your IDL-file contains the 'count' word as well.
For example,
[id(1)] HRESULT Test([in] IDispatch* count);<br />
<br />
[id(2),propget] HRESULT Count([out, retval] double *pVal);<br />
[id(2),propput] HRESULT Count([in] double newVal);
With best wishes,
Vita
|
|
|
|
|
IMHO, it is happened because a TLB has only one copy of words which are similar, but differ only by uppercase or lowercase letters.
With best wishes,
Vita
|
|
|
|
|
Hi guys, I have a COM question which has more to do with design than with actual code.
I have a object A and object B. Both objects have exactly the same interface, however, underneath their interface, they have different implementations.
I also have object C which needs to use the interface that both A and B expose. However, depending on some other criteria, object C needs to either use object A's implementation or use object B's implementation.
I have the following questions:
* How do I have object A and B both installed and registered on the same machine (same interfaces but different implementation). Is it OK to have a different GUID, but the same interfaces(methods, properties)?
* What is the most transparent way of making object C load a different implementation (A or B) depedning on which one it needs?
Could anyone help me with the above? Any pointers, advice, thoughts or questions will be greatly appreciated.
Jeremy.
Jeremy Pullicino
Professional C++ Developer
Done any hacking lately?
|
|
|
|
|
Oh boy!... you just cannot ask a simple question can you....
Well, first of all there is no ptoblem at all with two objects with exactly the same interface. But that is really not the main issue behind your design requirements.
Now the part of object C creating an instance of A or B, can be handled in several ways.
I don't think either Containment or Aggregation will help. (COM gurus will be able to answer that better).
So you can have a switch in your object C that either creates A or B. But that just does not look too elegant.
You could consider creating a single COM object D. D provides the COM interface to a base class Z. From Z you derive A and B which provide the different implementations for the interfaces.
Now somewhere in your COM D object you will have Z = new A or Z = new B and then you use Z->Interface().
So you have a single COM object not two. But inside the COM object you use standard OO polymorphism to handle to different implementations of A and B.
I think I may be rambling now. But you may want to think along this path.
Hope this helped.
|
|
|
|
|
If the two objects are seperate COM objects then it simply a case of each having a different Class ID (CLSID) and both supporting the same Interface ID (IID).
Your outer program can create an instance of the either object by selecting the relavent Class ID in the CoCreateInstance call
|
|
|
|
|
The previous post answers your question.
To make it even more configurable you might want to implement a CATID system
and let the objects themself decide if they are matching the critera.
|
|
|
|
|
You never let go of those damn categories do you?
--
Please state the nature of your medical emergency.
|
|
|
|
|
>> Is it OK to have a different GUID, but the same interfaces(methods, properties)?
yes, that's a "key intention" of COM.
>> What is the most transparent way of making object C load a different implementation (A or B) depedning on which one it needs?
using a CLSID or ProgID of the component to load.
The "perfect COM way" would be to create your own COM Category (the UUID for this one is called CATID), and register "all possible" COM servers under this category. This way C could enumerate the components it has available to work with on the current machine.
Auch den Schatten will ich lieben weil ich manchmal lieber frier' Rosenstolz [sighist]
|
|
|
|
|
We do it via progid. When the user chosses which integration module to use via the settings UI, the progID of that component is stored in the registry. When it comes the time to create A or B ( or up to F in our cases) the progid is read, and the component is instantiated using it.
|
|
|
|
|
I think that it depends on when your object C would know about some criteria.
The best solution is a Moniker like "C:A" or "C:B" or "C:criteria". When this Moniker will be bound, he is possible to return the appropriate object A or B. On VB-client: Set o = GetObject("C:xxx"), on C-client: CoGetObject("C:xxx",IID_Ix, &px); But there is no any real C object.
If you wish to have the real C object, then you can derived objectC-class from your known interface Ix and realize all of his methods to delegate simply these calls to some A_or_B object. For example
class objectC : public Ix ...
{
CComPtr<Ix> m_A_or_B;
...
STDMETHODIMP IxMethod(...params...)
{
if( m_A_or_B )
return m_A_or_B->IxMethod(...params...);
return E_UNEXPECTED;
}
};
m_A_or_B object can be created by COM common way through the criteria.
With best wishes,
Vita
|
|
|
|
|
Hi,I donot think it is a question.
First ,you should know some concepts.
Interface means the assembly of a bunch of functions.It is not an object.One Interface has one UUID called as IID_XXX.
CoClass stands for object which implements some interfaces.One CoClass has one UUID called as CLSID_XXX
Library looks like a DLL or EXE file.One library can contains and exporses one or more CoClass.
So the solutions of your question can be like the followings:
No.1
You create a library "La",which contains two coclasss
coA and coB,which both implements the interface Interace0.In your application you can create object coA or coB then query their's interface0 to execute some method.
No.2
You can create two library "La" and "Lb",which contains coA and accordingly.the following steps is same to No1
SORRY My poor words.
SIMPLE IS BEAUTY
|
|
|
|
|
I get an RPC Server Unavailable (800706ba) on some NT4 Servers when calling it this way:
CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
Any ideas what might be causing this to fail?
Jason Henderson start page articles "If you are going through hell, keep going." - Sir Winston Churchill
|
|
|
|
|
BSTR, CComBSTR, CString, CStringT, char, TCHAR, LPCSTR, LPSTR, UCHAR, ..., ..., ...
Why so may God damn types? I hate working with all of them! You want to use one type, but you always end up having to use a zillion types because of all those functions that takes a different type all the time!
Perhaps I don't understand them well enough to appreciate them, anyone could direct me to some documentation or something? I mostly have problems with conversions and I'd like to learn more about string type so I can actually understand what I'm doing!
Is there one particular type I should use with COM/ATL that is easier to work with?
One ring type to rule them all!
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|
|
Hehe! Well I could say to use _bstr_t but now you will complain that you want the string manipulation functions, right? Stay with CComBSTR and/or CString .
Good luck.
ÿVOTD:10 "But the angel said to them, "Do not be afraid. I bring you good news of great joy that will be for all the people. 11Today in the town of David a Savior has been born to you; he is Christ the Lord."" - Luke 2:10-11
|
|
|
|
|
ANSI vs. Unicode, the additional COM BSTR's that rely on a separte allocator, All their wrapper classes, separate typedefs for constant and non-constant strings, the cool MFC CString class, the (academically) well designed STL string class (that came much to late to become standard).
That's life in C++.
Now, if we have a look at VBasic, with one type to rule them all, you have a type free variable that holds a string without member functions (internaly a BSTR), and a string with member functions (internally some VB String object). It's even worse of a PITA.
Auch den Schatten will ich lieben weil ich manchmal lieber frier' Rosenstolz [sighist]
|
|
|
|
|
In case you are still wondering there is a really good article posted on this site about the different string types (at least for a basic understanding).
http://www.codeproject.com/string/CPPStringGuide1.asp
Give it a try!
|
|
|
|
|
error MIDL2025 : syntax error : expecting a type specification near "IMessage"
for this:
__interface IMAPIAdmin : IDispatch
{
[id(1), helpstring("method Logon")] HRESULT Logon([in] ULONG ulUIParam, [in] BSTR strProfileName, [in] BSTR strPassword, [in] ULONG flFlags);
[id(2), helpstring("method GetMessage")] HRESULT GetMessage([in] BSTR strEntryID, [out,retval] IMessage** ppIMessage);
};
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|