|
Interface function already return a HRESULT, and your owner return value must be defined in the last argument with [out,retval], example:
myFunction([in] long id, [out,retval] long* pNumber)
By the way, you must not use "short" type , instead using "long".
|
|
|
|
|
What's the difference between COM and OLE?
|
|
|
|
|
A couple of years.
What we refer to as COM today was called OLE a few years ago. Just about every book dealing with COM has a chapter explaining the origins.
|
|
|
|
|
What's the difference between Interface and dispInterface?
|
|
|
|
|
A dispatch interface is usually used by late bound languages such as VB or JavaScript to call, or invoke, methods on your object.
|
|
|
|
|
as mentioned in the above comment the difference is the late binding but the actual differnce is under the hood in the depths of the COM architecture. Dispinterface are just IDispacth Interfaces and don't rely on v-tables. Custom interfaces (non-IDispatch) use vtables and are much faster than IDispatch interfaces. But alas VB has no support (or had no support... i hear the latest release does) for v-table driven interfaces.
Hope this helps some.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Hi!
I have developed a context menu shell extention.
It is registered successfully but it doesn't work.
Can anyone tell me what is reason behind it.
Thanks in anticipation.
|
|
|
|
|
Hello,
Is there another way of detecting if the client was crashed rather than
pinging it ? The same question for the server rather than to call a method
and to look at the RPC error.
Can it be possible to diagnose the origin of the error ?
In another words, what are the causes of the DCOM server crash ?
The causes can be the network, the computer or the server (software) which
was dead or was blocked... or a mixture of all of this.
Can it be possible to prevent it ?
Thanks by advance for your answers
|
|
|
|
|
Why do you care if the client crashed, especially with out of proc components. Your server is only kept alive for the time that clients hold refs to it. If the client crashes, DCOM has a ping mechanism that will shut your server down in 6 minutes. There could be anything that could cause a DCOM error including all of what you mentioned. If you are concerned you could create a thread that goes off and instantiates your DCOM server. The main thread can then carry on its merry way. You can even use WaitForSingleObject to set your own timeout so that you don't have to wait an extended period of time to see if the creation or call failed.
|
|
|
|
|
First, thanks for your answer.
I agree with you as regards the server. Furthermore, my server is an NT service and so, it is always kept alive ! (or virtually certain )
I need to know when the crash was caused and what provoked the crash of the clients which can also be server of my NT service. I can not wait 6 minutes to know if a client is dead: It would be catastrophic for my application
Can you supply me an example of use of WaitForSingleObject to test if a call failed ?
Thank you very much.
|
|
|
|
|
I'm developing a system that needs to dynamically call a number of different COM objects without the need to rebuild the service everytime a new object is added.
What I'm proposing is to have a common COM object exposing the generic method for all objects and use multiple inheritence to build each different COM object and override the generic method.
By building the service with the common COM object I can then create the appropriate COM object by getting the CLSID & LIBID from the registry and by getting the base interface have access to the common method.
Two questions.
1) Will this work, am I making it more difficult than it should be or is it a non-starter?
2) Has anybody got any examples of multiple inheritence using ATL. I've been scouring the web and haven't come up with anything half decent.
I've been away from COM for over two years working purely in C++ so I'm a bit rusty so please forgive my stupidity.
Cheers
Darren Mann
|
|
|
|
|
i´m totally ignorant about com, so don´t flame me, please
how do you declare a pointer to an interface whose "name" ( eg. IPicture ) you don´t know. I´m trying to use the real player activeX control, but i can´t find the name on their on-line docs, just the clsid. How do you get to know the names of the methods like the vb ide does. i´ve tried with Ole Viewer, but i couldn´t find anything
thanks
Gabriel
don´t worry, drink happy
|
|
|
|
|
Look in Ole View or the VB object browser
|
|
|
|
|
I have this COM object that behind a firewall the transaction support attribute is "reqired" and I am able to access this COM without any issues. However, to put this COM behind a firewall and I am forced to changed the transaction support attribute to "Not Supported" from "reqired". Are there any known issues or changes that should be implemented to work around this? What can I modify to get this to function correctly.
Thank You,
Coding Away!
David
|
|
|
|
|
Hallo.... can anybody help me to get COM tutorials on web??? i'm new to COM familiar in windows programming
-Hariharan
|
|
|
|
|
|
He all you COM gurus,
can you help a complete retard out of jam.
Hopefully this is related enough to COM to be in this forum.
I was wanting to play around with DirectPLay8.
Taking the SimpleServer Example Code that comes with the
DirectX 8.0 SDk, i am simply trying to transferr the code from Win32 api
and make it a little more modular in a MFC project.
but i ran into the snag of i cant even get COM to initialize.
taking the following line from the sample code
// Init COM so we can use CoCreateInstance
CoInitializeEx( NULL, COINIT_MULTITHREADED );
I get the following compile error:
error C2065: 'CoInitializeEx' : undeclared identifier
error C2065: 'COINIT_MULTITHREADED' : undeclared identifier
these two are defined in objbase.h.
I included all the files from the sample code:
#include <basetsd.h>
#include <dplay8.h>
#include <dpaddr.h>
#include <dxerr8.h>
#include "DXUtil.h"
and all the libs from the project:
dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib
but it still doenst seem to include objbase.h
what am i missing? I just want to make this little line of code Initialize COM
and i will die happy.
thanks
|
|
|
|
|
So it doesnt get defined becuase of the following lines within objbase.h
#if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
WINOLEAPI CoInitializeEx(LPVOID pvReserved, DWORD dwCoInit);
#endif // DCOM
Im not sure what i did wrong and why neither of these (_WIN32_WINNT || _WIN32_DCOM) are not defined in my MFC app that was created by appwizard
if you havnt figured it out yet, i am a complete novice.
Any leads will help.
|
|
|
|
|
I am sorry to have wasted anyones time with this problem.
It was a friggin typo.
Within my project settings for preprocessor definitions i had missed typed
"_WIN32_DCOM"
i had typed "WIN32_DCOM"
but i DID state in my initial message that i was a complete retard.
Thanks.
|
|
|
|
|
Hi All,
My problem is about casting between these types.
the scenario is below.
getdocument -> getactiveelement ->
"it's a frame" I need a way of casting this IHTMLElement to IHTMLElement2 or to IHTMLWindow2
/*
IHTMLElement* pa_el;
...get_activeelement(&pa_el);
CComQIPtr<ihtmlelement2,&iid_ihtmlelement2> pa_el2(pa_el);
I have a dispatch here in pa_el2 but it seems as something is wrong because when I call doScroll, I get errors... if I cast to IHTMLWindow2... it simply returns NULL... (myframe == null)
CComQIPtr<ihtmlwindow2,&iid_ihtmlwindow2> myframe(pa_el);
How can I access to a frame object if I have it as an IHTMLElement?
Please Help...
IHTMLElement and IHTMLElement2 and IHTMLWindow2
|
|
|
|
|
Can someone give me an example how i can connect to a MSDE database throw a COM interface with SQL qustenions.
My problem is:
There is an database based om MSDE and there are diffrent applications who vill store and read data from the database, i will make an COM-interface who access the database with SQL questions.
The meaning of this is to make it so easy as possible to access data to the database, the programmers that programing the applications will not no how the database struture is.
They will connect with a procedure an with a couple op parameters like this:
addfuntion(operator, date, car_typ, modell_number, ......, .....,.....)
There will be a couple of interface with a method in each interface.
I will use COM ATL and SQL in Visual C++.
Please can someone here give me a example of this?
|
|
|
|
|
Use OLE DB or ADO there are plenty of examples out there.
|
|
|
|
|
The company i work for said that i should use ATL, ADO gives more code then necessary.
Please anyone give me some URL:s to my problem.
|
|
|
|
|
Are you using VC++? If so you have all you need. Look at MSDN for OLE DB. In VC++ start a new ATL project and insert a new object, choose Data Access and select Consumer.
|
|
|
|
|
Hi,
I am making use of a COM object. One member function returns a collection. I index the object i need with the 'Item' Function. My problem is the object returned as a variant. And i have little clue how to turn it into the object it show be.
Thanks in advance
Rich
PS
I have little experience! So please make it as simple as possible
|
|
|
|